Kamil
Kamil

Reputation: 812

proper .htaccess settings to redirect home.html to main url

I would like to redirect my domain.com/home.html to just domain.com url, i've set some rules but it's redirecting me to domain.com/?url=home. Settings look like this:

RewriteRule /home.html http://www.domain.com/ [R=301,L]

Why it puts ?url=home at the end?

Upvotes: 0

Views: 1324

Answers (2)

Michael Berkowski
Michael Berkowski

Reputation: 270767

Make sure your rules are in the right order. This one will need to come first to avoid being affected by subsequent writes...

RewriteRule /home.html http://www.domain.com/ [L,R=301]
RewriteRule ^(.+)\.html$ index.php?url=$1 [L]

RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

Upvotes: 0

milan
milan

Reputation: 12420

RewriteRule ^(.*)home\.html$ $1 [R=301,L]

Upvotes: 1

Related Questions