Ayyappan Swaminathan
Ayyappan Swaminathan

Reputation: 15

rewrite url module in windows does not redirect

I have used rewrite url module but I am not able to redirect to the target page and I am getting error as:

The requested URL /old.html was not found on this server.

Here is my code:

<IfModule mod_rewrite>
    RewriteEngine On
    RewriteRule ^old.html$ new.html [R]
</IfModule>

Upvotes: 0

Views: 110

Answers (4)

Ayyappan Swaminathan
Ayyappan Swaminathan

Reputation: 15

I've also tried this code for

RewriteEngine On 

RewriteBase /

RewriteRule ^old.html$ /new.html [R=301,L]

error as The requested URL /old.html was not found on this server.

How to check the load module in apache server?

Upvotes: 0

Tyler Carter
Tyler Carter

Reputation: 61567

You need to escape the . in .html with a \

So its:

RewriteEngine on
RewriteRule ^old\.html$ new.html [R]

Upvotes: 1

T0xicCode
T0xicCode

Reputation: 4941

Try also setting the RewriteBase to / like so

RewriteBase /

Upvotes: 0

Residuum
Residuum

Reputation: 12064

Is AllowOverride set to All in your httpd.conf? Like this:

   AllowOverride All

Also, your .htaccess should inlcude the L modifier for the last rule, and if you really want to redirect permanently, R=301:

RewriteEngine On 
RewriteRule ^old.html$ /new.html [R=301,L] 

Upvotes: 2

Related Questions