Master345
Master345

Reputation: 2276

simple .htaccess 301 redirect multiple pages

So my .htaccess file looks like this

RewriteBase /
Redirect 301 /page.html http://www.yoursite.com/newpage.html
Redirect 301 /page2.html http://www.yoursite.com/newpage.html

and it doesn't redirect my page.html

and if i leave it

RewriteBase /
Redirect 301 / http://www.yoursite.com/newpage.html

it works, and redirect all my website. Now why is not working, and believe me, i have page.html near .htaccess file, and the frustation is that i have somthing like 10 .html to redirect, not more ... :(

Can anyone help me?

Upvotes: 0

Views: 1795

Answers (1)

Ulrich Palha
Ulrich Palha

Reputation: 9539

To get the equivalent result you can add this to your .haccess file before any other rules.

RewriteEngine On
RewriteBase /

#redirect page or page2 .html
RewriteRule ^page(|2)\.html$ http://www.yoursite.com/newpage.html [NC,R=301,L]

Upvotes: 4

Related Questions