Need Help Correct Regular Expression Redirect Code

At the top of your .htaccess file, before your existing WordPress directives, you could do something like the following to redirect the old permalink: RewriteRule ^\d{4}/\d\d/([\w-]+\.html)$ /$1 [R=301,L] The RewriteRule pattern matches against the URL-path less the slash prefix. \d{4}/ – matches the 4-digit year, followed by a slash. \d\d/ – matches the 2-digit month … Read more

How to fix category url 404’s after category permalink change

RewriteRule ^stores/(.*)/$ /stores/$1-coupon-codes [R=301,NC,L] You can perhaps use a negative lookahead assertion to exclude URLs that already contain -coupon-codes from being redirected again, thus preventing a redirect-loop (which I assume is what’s happening here). For example: RewriteRule ^stores/(?!.*-coupon-codes)(.+)/$ /stores/$1-coupon-codes [R=301,NC,L] The negative lookahead (?!…) causes the pattern match to fail when the URL already contains … Read more

Issue with htaccess redirection in WP Multisite

Every URL that has example.com/<non-existent-page> redirects to the main page: example.com/es/. This is presumably being done by WordPress itself, as there is nothing in what you’ve posted (in .htaccess) that is doing this. You probably need to add an additional “wildcard” redirect to redirect /<anything> (except for /es and /en) to /es/<anything>. For example: RewriteCond … Read more

When is it necessary to have Header unset Vary in .htaccess

Header unset Vary This is probably a workaround for a supposed bug in Apache (#58231)*1 that could prevent certain caching proxies from caching the response when the Vary: Host HTTP response header is set. Apache might be setting this automatically when querying the HTTP_HOST server variable in a mod_rewrite RewriteCond directive (or Apache Expression). *1 … Read more

Access files at new location using old file paths

I believe I’ve found the solution. I add the following RewriteRule ^example_directory/files/(.*) new_directory/$1 to my WordPress .htaccess rules like so: RewriteEngine On RewriteBase / RewriteRule ^example_directory/files/(.*) new_directory/$1 RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] I couldn’t get it working before and I think the key was moving the … Read more

htaccess redirect – replace special character

Try it like this, replacing your existing redirect (which is now the 2nd rule below): # Repeatedly replace all hyphens with %20 – internally RewriteRule ^language/(.*)-(.*) language/$1\%20$2 [N,DPI] # Redirect to query string RewriteRule ^language/(.*) /members/?members_search=$1 [NE,R=301,L] This achieves the hyphen replacement and redirect to query string in just 1 external redirect. No additional redirect … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)