Jump to content
The mkiv Supra Owners Club

Website help with MOD_REWRITE code...


edd_t

Recommended Posts

Hello,

 

Our company has decided to change name (how annoying) and want to make sure that the correct name is show in the browser URL.

 

We currently have http://www.bessoholdings.co.uk and http://www.besso.co.uk

 

When someone goes to http://www.bessoholdings.co.uk I need it to show as http://www.besso.co.uk

 

From much google'fu all I have come up with is the following that doesnt work :(

 

RewriteEngine on

RewriteCond %{HTTP_HOST} !^www.bessoholdings.co.uk$ [NC]

RewriteRule ^(.*)$ http://www.besso.co.uk/$1 [R]

 

Anyone help at all?

 

Thanks,

 

Edd...

Link to comment
Share on other sites

Take the "!" out of the second line as *I think* at the moment that is saying "if the domain isn't this" then redirect. Alternatively you could leave the "!" in and change the domain to your primary, then anything that isn't your primary domain will redirect to it (this is probably the better way to do it, then you won't have to add a separate condition for each domain you have).

 

I'm on my phone at the moment but will be able to give you the exact code when I get home if you need it :)

Link to comment
Share on other sites

cheers guys, am still having no luck. took Mawby's and edited it with my URL and the site stopped working, whoops! lol I must have put something in wrong somewhere!

 

so far have tried all of the follwing:

 

RewriteCond %{HTTP_HOST} ^bessoholdings\.co\.uk$ [NC]

RewriteRule ^/?$ "http\:\/\/www\.besso\.co\.uk" [R]

 

 

RewriteCond %{HTTP_HOST} ^bessoholdings\.co\.uk$ [NC]

RewriteRule ^/?$ "http\:\/\/www\.besso\.co\.uk" [L]

 

RewriteCond %{HTTP_HOST} ^www.bessoholdings.co.uk$ [NC]

RewriteRule ^(.*)$ http://www.besso.co.uk/$1 [R]

 

RewriteCond %{HTTP_HOST} !^www.besso.co.uk$ [NC]

RewriteRule ^(.*)$ http://www.bessoholdings.co.uk/$1 [L]

 

RewriteCond %{HTTP_HOST} ^bessoholdings\.co\.uk$ [NC]

RewriteRule ^/?$ "http\:\/\/www\.besso\.co\.uk" [L]

 

But still no luck. :(

Link to comment
Share on other sites

this is also in my .htaccess script, would that make a difference? perhaps the Authname part??

 

order deny,allow

deny from all

allow from all

order deny,allow

deny from all

AuthName bessoholdings.co.uk

AuthUserFile /home/********/public_html/_vti_pvt/service.pwd

AuthGroupFile /home/********/public_html/_vti_pvt/service.grp

Link to comment
Share on other sites

Would a 301 server-side redirect be more appropriate? Possibly not, just a thought.

 

Have you tried something like this? -->

RewriteEngine on
RewriteRule www\.bessoholdings\.co\.uk www.besso.co.uk

 

I don't know the performance effect of using the rule to filter the domain substitution rather than using a RewriteCond. It might not be best practise but I can't see how it wouldn't work. If it works, it'll at least confirm that Apache's rewrite module is compiled in and functional.

 

It shouldn't make any diffference but I noticed mawby's code didn't have a dollar end-of-string marker at the end of the RewriteCond filter, whereas all your attempts in post #4 do. Hence, maybe try this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.bessoholdings.co.uk
RewriteRule ^(.*)$ http://www.besso.co.uk/$1

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. You might also be interested in our Guidelines, Privacy Policy and Terms of Use.