Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress .htaccess redirects file extension and case-insensitive
    primarykey
    data
    text
    <p>I am moving a website to wordpress but I want to keep the current URL structure for SEO purposes.</p> <p>The current site uses a combination of .htm and .html files. I found success in redirecting to .htm when the request is .html. </p> <p>For example</p> <pre><code> RedirectMatch 301 (.*)\wp-site/mywebpage.html$ http://www.mydomain.com/wp-site/mywebpage.htm </code></pre> <p>I have trouble with the following: </p> <p>when the .html file has upper and lower case. I can't seem to find a solution to redirect any request despite the case to its .htm equivalent</p> <p>For example: My-Posts/Alpha-Page.html needs to redirect to my-posts/alpha-page.htm or MY-POSTS/ALPHA-PAge.html redirects to my-posts/alpha-page.htm (or any of "my-posts/alpha-page" that contains uppercase. basically all requests despite case needs to redirect to all lowercase .htm file)</p> <p>I know it's a little difficult because it's a combination 1) I'm redirecting to .htm and 2) for the case insensitivity.</p> <p>Few things to consider:</p> <ol> <li>I know Wordpress posts are case-insensitive. Wordpress's static page are case-sensitive.</li> <li>I know RedirectMatch won't work because it matches it exactly.</li> <li>I believe I need to use RewriteCond and RewriteRule, but can't seem to find "good" step by step explanations. Also, I don't understand their variables (ie: %{HTTP_HOSTS}) and the regular expression convention.</li> <li>I am not an Apache/.htaccess or regular expressions expert by any means.</li> </ol> <p>Theoretically, it seems there should be a way for it to work. I will continue to see if I can find solutions here at stackoverflow or other outside resources and if I do find a solution here at stackoverflow, I will marked this as solved and have it removed.</p> <p>Any help is appreciated!</p> <p>Thanks</p> <p>UPDATE 06/17/2011:</p> <p>Here is my current .htaccess file</p> <pre><code> # BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase /wp-test-2011-06-13/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wp-test-2011-06-13/index.php RedirectMatch 301 (.*)\wp-test-2011-06-13/redirect.html$ http://www.mydomain.com/wp-test-2011-06-13/redirect.htm RewriteRule ^ORLANDO-criminal-defense-attorney/defense-attorney-NEJAME.html$ /orlando-criminal-defense-attorney/defense-attorney-nejame.htm [QSA,NC,R=301] &lt;/IfModule&gt; # END WordPress </code></pre> <p>UPDATE 06/20/2011:</p> <p>Here is my current .htaccess file:</p> <pre><code> # BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; Options +FollowSymlinks RewriteEngine On RewriteBase /wp-test-2011-06-13/ RewriteRule ^/wp-test-2011-06-13/index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* /wp-test-2011-06-13/index.php RedirectMatch 301 (.*)\wp-test-2011-06-13/redirect.html$ http://www.mydomain.com/wp-test-2011-06-13/redirect.htm RewriteRule ^ORLANDO-criminal-defense-attorney/defense-attorney-NEJAME\.html$ /orlando-criminal-defense-attorney/defense-attorney-nejame.htm [QSA,NC,R=301] &lt;/IfModule&gt; # END WordPress </code></pre> <p>I get a Wordpress "Page Not Found" page when I type <a href="http://www.mydomain.com/wp-test-2011-06-13/ORLANDO-criminal-defense-attorney/defense-attorney-NEJAME.html" rel="nofollow">http://www.mydomain.com/wp-test-2011-06-13/ORLANDO-criminal-defense-attorney/defense-attorney-NEJAME.html</a> (or lowercase equivalent with .html)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload