Joshua
Joshua

Reputation: 47

How do I redirect my website URL using htaccess?

I need to display

www.defensionem.com

on my site. I tried re-directing through CPanel Redirection tool, and I redirected it.

But it has stuck in a loop.

I cleared cookies, did everything possible, so the issue lies in the server side.

I noticed the changes in the .htacess file before and after redirecting.

Here is the code.

RewriteCond %{HTTP_HOST} ^defensionem\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.defensionem\.com$
RewriteRule ^/?$ "http\:\/\/www\.defensionem\.com\/" [R=301,L]

Now how do I re-direct my website to

www.defensionem.com

Upvotes: 1

Views: 53

Answers (1)

Arun Krish
Arun Krish

Reputation: 2153

Try this

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

Upvotes: 1

Related Questions