|
|
|
|
||||||
| alt.apache.configuration Apache web server configuration issues. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I had mentioned in an earlier thread that I'm using several domains
parked on top of another domain, and based on the domain that's typed in the visitor might see different information. Originally, I had a problem that if they left off the trailing /, they were being redirected to the main domain and not seeing the information specific to the domain that they typed in. I was able to resolve this by adding this to the .htaccess: RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+[^/])$ $1/ However, I recently discovered that if they leave off the opening www, the same problem happens. So, I need a way to see if the www is present, and if not then plug it in. I read through the Apache manual and didn't see a reference to this, so I'm hoping you guys can me out again. I know how to push something to the end, but how do I get it at the beginning? TIA, Jason |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
"Jason Carlton" <jwcarlton@gmail.com> wrote in message
news:f678a10d-bb7a-4adf-8f38-f21bc0f76e67@e6g2000prf.googlegroups.com... >I had mentioned in an earlier thread that I'm using several domains > parked on top of another domain, and based on the domain that's typed > in the visitor might see different information. > > Originally, I had a problem that if they left off the trailing /, they > were being redirected to the main domain and not seeing the > information specific to the domain that they typed in. I was able to > resolve this by adding this to the .htaccess: > > RewriteCond %{REQUEST_FILENAME} -d > RewriteRule ^(.+[^/])$ $1/ > > However, I recently discovered that if they leave off the opening www, > the same problem happens. So, I need a way to see if the www is > present, and if not then plug it in. > something like this? RewriteCond %{HTTP_HOST} !^www\. RewriteRule (.*) http://www.%{HTTP_HOST}$1 [R=301,L] |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Jan 15, 4:58am, "phantom" <nob...@blueyonder.invalid> wrote:
> "Jason Carlton" <jwcarl...@gmail.com> wrote in message > > news:f678a10d-bb7a-4adf-8f38-f21bc0f76e67@e6g2000prf.googlegroups.com... > > > > > > >I had mentioned in an earlier thread that I'm using several domains > > parked on top of another domain, and based on the domain that's typed > > in the visitor might see different information. > > > Originally, I had a problem that if they left off the trailing /, they > > were being redirected to the main domain and not seeing the > > information specific to the domain that they typed in. I was able to > > resolve this by adding this to the .htaccess: > > > RewriteCond %{REQUEST_FILENAME} -d > > RewriteRule ^(.+[^/])$ $1/ > > > However, I recently discovered that if they leave off the opening www, > > the same problem happens. So, I need a way to see if the www is > > present, and if not then plug it in. > > something like this? > > RewriteCond %{HTTP_HOST} !^www\. > RewriteRule (.*)http://www.%{HTTP_HOST}$1 [R=301,L]- Hide quoted text - Thanks, Phantom! But when I plug that in, it takes me to http://www.parkeddomain.compublic_html/, which of course just gives an error that the domain doesn't exist. If I remove the $1 in the RewriteRule, you can leave off the www when going to the homepage (which is 1000 times better than before!), but not an internal directory. So, http://parkeddomain.com works, but not http://parkeddomain.com/directory/ (this will redirect to the main domain instead of the parked one). I was, however, able to make this work: RewriteCond %{HTTP_HOST} !^www\. RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] I'm not sure if this is the BEST option, but it does work. Thanks again, Phantom, Jason |
|
![]() |
| Outils de la discussion | |
|
|