Forum Moderators: phranque
RewriteEngine on
RewriteCond %{QUERY_STRING} ^q=contact
RewriteRule ^ /contact-us/? [L,R=301]
RewriteCond %{QUERY_STRING} ^q=node/6
RewriteRule ^ /industry/? [L,R=301]
RewriteCond %{QUERY_STRING} ^q=node/7
RewriteRule ^ /exams/? [L,R=301]
RewriteCond %{QUERY_STRING} ^q=node/5
RewriteRule ^ /company/? [L,R=301]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPres
RewriteCond %{REQUEST_URI} /arizona [NC]
RewriteRule .* http://www.domain.com/arizona/ [R=301,L] You can use RedirectMatch
I have tried using a rewrite condition such as this:You need a second RewriteCond so the rule only applies to incorrectly cased requests. Otherwise it goes around in circles, as you've found.
RewriteCond %{REQUEST_URI} /arizona [NC]
RewriteRule .* http://www.example.com/arizona/ [R=301,L]
RewriteCond %{REQUEST_URI} ^/arizona [NC]
RewriteCond %{REQUEST_URI} !^/arizona/$
RewriteRule .* http://www.example.com/arizona/ [R=301,L]
See how that works? But if the rule is only intended for one specific URI, then that belongs in the body of the rule so the server doesn't waste time evaluating conditions the rest of the time. Make sure the [NC] flag is in the right place: RewriteCond %{REQUEST_URI} !^/arizona/$
RewriteRule ^arizona http://www.example.com/arizona/ [NC,R=301,L]
But you wouldn't want to, because that's a mod_alias directive and we've already established that the site uses mod_rewriteYa know, I see people saying that but servers nowadays preload most mods so I don't see the issue. Just don't mix the two in the same section of the code. Besides RedirectMatch would only take one line. I don't do it currently but I've used both together without issue.
don't mix the two in the same section of the code
there is no (who links to you) tab
I am worry that all my files will show up eventually. It is weird!