Double domain name in category URL-s

You can “workaround” the issue with a redirect in .htaccess, although it’s not clear why this double-domain-URL would be accessible in the first place. So, we can redirect URLs of the form example.com/example.com/?cat=6 to example.com/?cat=6, which you then say is correctly redirected to example.com/category by WordPress. For example, at the top of your .htaccess file: … Read more

browser caching not disabled after disabling in .htaccess

After struggling with the issue for several days here are the steps that I took to finally overcome the problem: Reset the .htaccess to default values(no luck) Add above values to .htaccess in order to disable leverage browser caching(no luck) Contacted my hosting provider and asked them to disable any potential caching policy on my … Read more

AWS WordPress Install – pages/posts 404 on restart until updating permalinks

This answer was based off the comment from @Rup on the question. I needed to add a .htaccess file to my source. I did this with the default contents: # BEGIN WordPress RewriteEngine On RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # … Read more

Redirect subdomain in Multisite installation?

RewriteRule ^(.*)$ https://example.com/summer/$1 [R=301] You need to include the L flag on the RewriteRule directive, ie. [R=301,L] and ensure this rule is near the top of the .htaccess file, before the existing WordPress directives. Without the L flag, processing continues and the request is further rewritten (by the WordPress front-controller) before the eventual (incorrect) redirect.

Changed permalink structure. Need help with redirecting old posts

…it redirected the old URLs to the new URLs without the end trailing slash and then redirected again with the trailing slash. So, it generated 2 redirects instead of one. RedirectMatch 301 ^/([^/]+)/([0-9]{4})/([0-9]{2})/([^/]+)/$ https://www.example.com/$4 In that case you should simply be able to append a trailing slash to the target URL in the above directive … Read more

htaccess – RewriteRule without redirect not working

You can add a rewrite rule to map to one of those pages with something like this: add_action( ‘init’, function() { add_rewrite_rule( ‘myparamname/([a-z0-9-]+)[/]?$’, ‘index.php?myparamname=$matches[1]’, ‘top’ ); } ); The first parameter of add_rewrite_rule is a regular expression to match a URL. The second parameter is an index.php non-pretty permalink URL, the URL parameters map directly … Read more

How To Allow Only Specific User Agent To Access a URL?

There are at aleast two ways you can block other user agents and allow only a few. This can be done by editing the .htaccess file in the root directory of your WordPress website. Option 1 Using mod_rewrite, add the code below at the top of your .htaccess file. <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_USER_AGENT} … Read more

Redirect parent taxonomy to it’s child

Assuming state and city are variable path segments, so you are essentially redirecting /investments/<one>/<two>/ to /investments/<two>/ then try the following at the top of your .htaccess file: # Redirect “/investments/<one>/<two>/” to “/investments/<two>/” RewriteRule ^(investments)/[^/]+/([^/]+)/$ /$1/$2/ [R=302,L] If you need any further explanation then just ask in comments. UPDATE: I’ve added an end-of-string anchor ($) to … Read more