Posts Tagged ‘mod_rewrite’

how to make 301 redirect

Assuming you want to forward old traffic from old domain olddomain.com to new domain newdomain.com, use the following .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule (.*) https://www.newdomain.com/$1 [R=301]
RewriteCond %{HTTPS} !on
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
</IfModule>

Leave a Comment

mod_rewrite not working

I will be updating this post with issues about mod_rewrite and its resolution ways.
1. I’ve faced with the problem when I worked with denwer (dklab solution, author: Dmitry Koterov), the following .htaccess was not working and returned 404 error:

RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteRule ^something/(.*)$ script.php [L]

How It was resolved:
I opened apache httpd.conf file and removed MultiViews [...]

Leave a Comment