Ben Vigil
January 30 2007, 05:59 AM
QUOTE(Adam Squier @ January 29 2007, 11:15 PM) [snapback]65046[/snapback]
Here's something from the httpd.conf file that might be useful:
[codebox]<VirtualHost *>
ServerName squirephotography.com
ServerAlias www.squirephotography.com
DocumentRoot /var/www/html
</VirtualHost>[/codebox]
I tried changing the ServerAlias to the right spelling, and then restarting the server, but it didn't seem to do anything.
It's about time for bed so I'll continue this in the morning. Or just ask them to fix it.
I really appreciate all the help everyone's given me. Thanks!!
Adam,
Dungan's way will work as desired and will redirect the browser and change the URL and all that stuff just like mod-rewrite. From the browsers' prospective, they are the same. The only difference is that mod_rewrite sends a "Location:" header to the browser from within the apache code, and Dungan's way sends a "Location:" header from within the php engine. Same diff. Anyway...
Your <virtualhost > settings are not going to affect what you are trying to do.
Kaitlin's code should work assuming that a) the mod-rewrite module is loaded and b) both domains are NOT pointed to the same virtual host in apache.
If both domains are handled by the same virtualhost config, her code will loop. Her code says, match anything and redirect to the correct site. If they are the same codebase, it will loop indefinitely. This is probably what Firefox was telling you. So modify it like so...
CODE
RewriteEngine on
RewriteRule ^.*squire.* http://squierphotography.com [R]
You can also add the [L] to tell mod-rewrite to make this the Last rule (i.e. skip the rest).
CODE
RewriteEngine on
RewriteRule ^.*squire.* http://squierphotography.com [L,R]
The regex code above may not be perfect, but it's close.