Forum Moderators: phranque
My domain is registered with networksolutions and it forwards www, (none), (wildcards), and images to my server:
www.example.com -> our ip address -> http://www.example.com
example.com -> our ip address -> http://www.example.com
images.example.com -> our ip address -> http://www.example.com
The last example (images.example.com), I wanted to set up the virtual directory or host in apache. I think my current settings affect the http request for images.example.com
Current Config in Apache:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteRule ^(iqc)(.*) http://www.example.com/imagehosting.php?$2 [NC]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Any Suggestions greatly appreciated.
=)
and completely different site on the same server:
www.spidersimple.com [/htdocs/spidersimple/]
Thank you jd again.
Your rule currently excludes "www.example.com" from being rewritten. Given what's there, how do you think you might exclude "images.example.com" as well?
There are two ways to do it. One takes one extra line of code, the other doesn't even require an extra line...
I presume you have read the Apache mod_rewrite documentation and tutorials, but if not, I commend it to you. An apt term for using mod_rewrite without understanding it is "SEO suicide" -- and I offer that with the most sincere of intentions. As well, a review of our Charter here will reveal that our intent and purpose is to discuss and educate, not to serve as a free code-writing service or help desk. No one here gets paid...
Jim
...Sorry... (when it comes to regex I'm an r-tard)
Okay. I solved the directory issue so "www" and "images" is the only accepted sub directories.
For Others...my solution was:
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{HTTP_HOST} !^(images\.example\.com)?$
[edited by: jdMorgan at 1:05 pm (utc) on Oct. 21, 2009]
[edit reason] example.com [/edit]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{HTTP_HOST} !^images\.example\.com$
RewriteCond %{HTTP_HOST} !^((www¦images)\.example\.com)?$
Jim