Deepak Ranjan Jena
Deepak Ranjan Jena

Reputation: 437

.htaccess redirection

My domain is http://www.somename.com.

I want if an user type {path to website}/index.php, it should redirect him to {site name}

basically I want to remove that index.php from the URL.

and one more thing, it should work both for {www.sitename} {sitename}

any idea is greatly appreciable.

Thanks in advance.

Upvotes: 0

Views: 161

Answers (2)

bobince
bobince

Reputation: 536339

Redirect permanent /index.php /

Note: you generally don't want to have a site available on both www and www-less hostnames. Pick one, and have the other variant redirect to it. This will let search engines know for sure they're the same site and not split reputation between them.

Upvotes: 1

Gumbo
Gumbo

Reputation: 655129

This rule should do it:

RewriteRule ^index\.php$ / [L,R=301]

Upvotes: 1

Related Questions