simply replace domain extension
3 posts
• Page 1 of 1
simply replace domain extension
Hi,
I'm looking to create a rule that simply replaces the domain extension in a URL (.com) with another (.net), leaving everything else in place. The problem I'm having is the domain could be anything (there are many domains and subdomains pointing at the site and more could be added at any point) that may or may not have a path or querystring so it's not possible to hard code in the domain names.
Basically what I believe I need is a rule that does something like a standard string replace: Replace(url,'.com','.net') so everything else in the URL remains untouched.
Is this possible?
Thanks
I'm looking to create a rule that simply replaces the domain extension in a URL (.com) with another (.net), leaving everything else in place. The problem I'm having is the domain could be anything (there are many domains and subdomains pointing at the site and more could be added at any point) that may or may not have a path or querystring so it's not possible to hard code in the domain names.
Basically what I believe I need is a rule that does something like a standard string replace: Replace(url,'.com','.net') so everything else in the URL remains untouched.
Is this possible?
Thanks
Re: simply replace domain extension
Hello,
I believe it will be possible with the following rule:
RewriteCond %{HTTP_HOST} ^(.*)\.com$ [NC]
RewriteRule .? http\://%1.net%{REQUEST_URI} [R=301,L]
I believe it will be possible with the following rule:
RewriteCond %{HTTP_HOST} ^(.*)\.com$ [NC]
RewriteRule .? http\://%1.net%{REQUEST_URI} [R=301,L]
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests