Reputation: 15
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
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
Reputation: 61567
You need to escape the . in .html with a \
So its:
RewriteEngine on RewriteRule ^old\.html$ new.html [R]
Upvotes: 1
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