Reputation: 3763
Cant figure out why this redirect doesn't work. Isn't this the right way to redirect a page to a directory (see last line)?
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.|$) [NC]
RewriteRule ^ www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.html [NC,L]
AddDefaultCharset UTF-8
ErrorDocument 404 /404.html
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
ExpiresActive On
ExpiresDefault "access plus 1 minute"
Redirect 301 /folder/name/main.html /a-nother-folder
Upvotes: 1
Views: 56
Reputation: 785156
Don't mix mod_rewrite and mod_alias. Change your code to:
AddDefaultCharset UTF-8
ErrorDocument 404 /404.html
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
ExpiresActive On
ExpiresDefault "access plus 1 minute"
RewriteEngine On
RewriteRule ^folder/name/main\.html$ /a-nother-folder [L,NC,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.html [NC,L]
Also try testing this in a different browser.
Upvotes: 1