Jump to content

htaccess is there a better way


Recommended Posts

That's pretty much how it's done - nothing wrong with it. Not much room to do it differently.

 

 

FWIW, here's what I do:

RewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule ^ //www.example.com%{REQUEST_URI} [L]

The differences are:

1. Mine checks whether the hostname is not what I want, as opposed to whether it is what I don't want.

2. I don't match the URL in the RewriteRule because it doesn't have to - %{REQUEST_URI} gives the same information.

3. It doesn't include the "http:" - redirecting to "//www.example.com" will keep the same protocol (http: vs https:) but change everything else.

 

With that pattern, yours would look like

RewriteCond %{HTTP_HOST} !^www.mysite.org$
RewriteRule ^ //www.mysite.org%{REQUEST_URI} [L]

Link to comment
Share on other sites

requinix, i think i was a little hasty with my reply, becuase when i use your code, i get..

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

IM guessing there is something ary... your continued support would be much appreciated.. kind regards J

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.