The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

The old site was based on php and there are lot of pages which are indexed, since we are keeping same urls in new wp sites but without .php extension at the end... Assuming your "old site" .php documents no longer exist (they shouldn't) then your current rule block to remove the .php extension would seem to be far more complex than it needs to be (and/or ...


1

To redirect just those 3 URLs (with variable ticket number) on the support subdomain then you can do something like the following before the WordPress front-controller (assuming the support subdomain resolves to the same place and is probably handled by WP) using mod_rewrite, in the root .htaccess file: RewriteCond %{HTTP_HOST} ^support\.example\.com [NC] ...


0

In my case it was Apache's DirectoryIndex issue. The wp-admin was being accessed by wp-admin/index.php but not with wp-admin and showing ERR_TOO_MANY_REDIRECTS. It sounds like Apache's DirectoryIndex may be set "incorrectly". Try resetting this at the top of your .htaccess file: DirectoryIndex index.php See the full answer here. Can't access admin ...


1

If this is happening on a regular basis, your security plugins appear to be failing. Below are several steps you can take to prevent this: Start by using a really good security plugin like Wordfence Security. I haven't had a successful hacking incident since I started using this. If that fails, or you just want an EXTRA STRONG lock-down, you can also try ...


0

So first, I'm quoting @MrWhite's comment: You can't do that sort of redirect in .htaccess - where are you expected to get the posts-category part from? And he's right — you shouldn't use the .htaccess. We have over 2,000 articles and 55,000 backlinks to these articles. If I just change the permalinks I will have over 50k 404s which will ...


1

You'll need the Header set .... directive, but to set it conditionally based on the URL. One way of doing this is to use mod_rewrite to set an environment variable (eg. ROBOTS_INDEX) when your URL criteria are met (for the URLs you want indexed) and use the env= argument to the Header directive to conditionally set the X-Robots-Tag header when this env var ...


0

WordPress has its own 404.php file in theme. WordPress will automatically use that page if a Page Not Found error occurs You need to edit this file or if your theme don't have this file then you need to create it. For more detail go to this link


0

I had the 'Too many redirects' on wp-admin only after migrating to a new server. The problem was incorrect permissions on the folder wp-admin plus the top-level files within it. Resetting the permissions fixed the issue. Hope that is of help to anyone who needs it.


2

Using insert_with_markers() function you can insert your rules only between WordPress comments e.i. # BEGIN WordPress and # END WordPress. So, you should use plain PHP to achieve your aim. Create your rules Read existing .htaccess and concatenate your and existing rules Write the file Here is a dirty example: <?php $str = "# BEGIN TEST\n# MY RULES\n#...


0

The E flag is being used for LiteSpeed as opposed to ENV for Apache. Where did you get this from? The LiteSpeed docs appear to show that LiteSpeed is the same as Apache in this respect and require env=, not E=, on the Header directive in order to conditionally set the HTTP response header based on the presence of an environment variable. Having tested this ...


1

Assuming the redirect is for a resource or page that does not exist then you are most probably better off using a redirect plugin, not .htaccess, in order to prioritise "normal site visitors" and not the redirected traffic. With a redirect plugin, the redirect logic need only be processed for requests that would otherwise return a 404 (Not Found). ie. Late ...


1

In order to catch either lang=en or lang=ru you can change those directives like this: RewriteCond %{QUERY_STRING} lang=(en|ru) # exclude all requests starting with /wp-admin/ RewriteCond %{REQUEST_URI} !^/wp-admin/ RewriteRule (.*) /%1/$1? [L,R=302] The (en|ru) part matches either en or ru and the surrounding parentheses make this a capturing group that ...


Top 50 recent answers are included