Z
Z
zarabotok2015-04-17 16:44:35
Search Engine Optimization
zarabotok, 2015-04-17 16:44:35

Problem in htaccess file, how to fix?

Good afternoon everyone.
I am preparing my blog for going online, trying to get rid of duplicate pages.
I write a command to the htaccess file, as per instructions I add after RewriteRule ^index\.php$ - [L]:
I add:
RewriteCond %{QUERY_STRING} ^replytocom= [NC]
RewriteRule (.*) $1? [R=301,L]
RewriteRule (.+)/feed /$1 [R=301,L]
RewriteRule (.+)/attachment /$1 [R=301,L]
RewriteRule (.+)/comment-page /$1 [R=301,L]
RewriteRule (.+)/comments /$1 [R=301,L]
RewriteRule (.+)/trackback /$1 [R=301,L]
RewriteCond %{QUERY_STRING} ^attachment_id= [NC]
RewriteRule(.*) $1? [R=301,L]
I save the whole thing and close it.
After that, I add one code to the topic and that's it.
/* Inserts the noindex,nofollow robot meta tag for pagination */
function my_meta_noindex () {
if (
is_paged() //
) {echo "".''."\n";}
}
add_action('wp_head', 'my_meta_noindex ', 3); // add your noindex,nofollow to head
BUT after 5 minutes I look at the htaccess file and it's already empty, everything I added has disappeared!
I do everything through the file manager, I save everything.
What is the problem?
Just in case, maybe it's a bug?
instructions for which I did: pro-wordpress.ru/chast-2-raskrutka-bloga/kak-izbav...

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman, 2015-04-17
@zarabotok

What permissions do you have on .htaccess?
Try setting it to 600 to allow the owner to read and write, and deny everything else.

L
Leonid Sysoletin, 2015-04-17
@sysoletin

Don't put your instructions between the lines

# BEGIN WordPress

# END WordPress

This place is taken over by WP and does what it wants there. But outside of these lines, he does not touch anything else.

M
Marat, 2015-04-18
@7kmarat

Check if you have installed a plugin that protects changes. Disable all plugins and check htaccess, if changes are not removed from htaccess, then everything is fine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question