Redirecting root url to home page
6 posts
• Page 1 of 1
- vanadiumtech
- Posts: 1
- Joined: 23 Aug 2012, 14:50
Redirecting root url to home page
I'm hacking my way through this, and would greatly appreciate your feedback.
In order to prevent duplicate content issues I would like to permanently redirect my root domain to the default page in the site
i.e http://www.site.com & site.com ---> to http://www.site.com/defualt.aspx
I already have an .htaccess file setup with the following code, which address another issue I faced a while back.
RewriteEngine On
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)?
RewriteRule ^(.*)(eurl.axd/.*)$ http(?%1s)://www\.%2/$1 [R=301,L]
What should be added to the file?
In order to prevent duplicate content issues I would like to permanently redirect my root domain to the default page in the site
i.e http://www.site.com & site.com ---> to http://www.site.com/defualt.aspx
I already have an .htaccess file setup with the following code, which address another issue I faced a while back.
RewriteEngine On
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)?
RewriteRule ^(.*)(eurl.axd/.*)$ http(?%1s)://www\.%2/$1 [R=301,L]
What should be added to the file?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirecting root url to home page
Hello,
There's one that redirects non-www to www version:
and there's one to redirect to default.aspx
Regards
Andrew
There's one that redirects non-www to www version:
- Code: Select all
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
and there's one to redirect to default.aspx
- Code: Select all
RewriteRule ^$ /default.aspx [NC,R=301,L]
Regards
Andrew
- tidaltides
- Posts: 24
- Joined: 27 Nov 2012, 21:57
Re: Redirecting root url to home page
This is only for version 3.0, right? Thanks.
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirecting root url to home page
It also works in Ape.
Re: Redirecting root url to home page
HeliconAndrew wrote:Hello,
There's one that redirects non-www to www version:
- Code: Select all
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
and there's one to redirect to default.aspx
- Code: Select all
RewriteRule ^$ /default.aspx [NC,R=301,L]
Regards
Andrew
Is this more efficient than the IIS default-document process?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirecting root url to home page
It is a substitution, I wouldn't say it's more or less efficient.
Regards
Andrew
Regards
Andrew
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 48 guests