Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
htaccess for 301 from .co.uk to .com not working
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- htaccess for 301 from .co.uk to .com not working
htaccess for 301 from .co.uk to .com not working
25-11-2008 1:26 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hi all
I am having some problems with a htaccess used to redirect .co.uk to .com
Both .co.uk and .com are pointed via dns at the same folder in the ccgi server. I am using this following script:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^www.domain.co.uk [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
But what is happening is that http://www.domain.co.uk/ is returning HTTP 200 OK
but the stylesheet and images are correctly being returned with a 301,
which then returns the new .com correctly as a HTTP 200 OK
So in the url address bar has the .co.uk, with associated file being served from the .com
Not ideal
Does anyone have an idea why this is not working correctly?
Ta
John
I am having some problems with a htaccess used to redirect .co.uk to .com
Both .co.uk and .com are pointed via dns at the same folder in the ccgi server. I am using this following script:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^www.domain.co.uk [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
But what is happening is that http://www.domain.co.uk/ is returning HTTP 200 OK
but the stylesheet and images are correctly being returned with a 301,
which then returns the new .com correctly as a HTTP 200 OK
So in the url address bar has the .co.uk, with associated file being served from the .com
Not ideal
Does anyone have an idea why this is not working correctly?
Ta
John
Message 1 of 3
(940 Views)
2 REPLIES 2
Re: htaccess for 301 from .co.uk to .com not working
25-11-2008 1:35 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hmm,
That should do it - it will rewrite the query string too, if your site uses them.
B.
Options +FollowSymLinks
RewriteEngine on
rewritecond %{HTTP_HOST} ^www\.domain\.co\.uk [NC]
rewritecond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)$ http://www.domain.com/$1?%1 [R=301,L]
That should do it - it will rewrite the query string too, if your site uses them.
B.
Message 2 of 3
(372 Views)
Re: htaccess for 301 from .co.uk to .com not working
25-11-2008 1:41 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I have changed and uploaded the htaccess file, but the redirect is not working for php files.
Css, and images are being redirected correctly.
Is there anything I can do to get it working on the php files?
Message 3 of 3
(372 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- htaccess for 301 from .co.uk to .com not working