CodeIgniter Forums
htaccess question: is this correct? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: htaccess question: is this correct? (/showthread.php?tid=8639)



htaccess question: is this correct? - El Forum - 05-25-2008

[eluser]codex[/eluser]
I'm testing my server on the implementation of wildcard DNS. I'd like to know if these conditions in the htaccess do what they're supposed to. If I'm correct, any request for a subdomain on scripto.nl should redirect to www.google.com. Right?:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.scripto\.nl?$
RewriteCond %{HTTP_HOST} ^([^.]+)\.scripto\.nl?$

RewriteRule ^$ http://www.google.com



htaccess question: is this correct? - El Forum - 05-26-2008

[eluser]Sean Murphy[/eluser]
codex, yeah, that's the idea. It could be cleaned up some though.

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.scripto\.nl$
RewriteCond %{HTTP_HOST} ^([^\.]+)\.scripto\.nl$

RewriteRule ^$ http://www.google.com



htaccess question: is this correct? - El Forum - 05-26-2008

[eluser]codex[/eluser]
[quote author="Sean Murphy" date="1211833461"]codex, yeah, that's the idea. It could be cleaned up some though.

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.scripto\.nl$
RewriteCond %{HTTP_HOST} ^([^\.]+)\.scripto\.nl$

RewriteRule ^$ http://www.google.com
[/quote]

It was basically only a sample to see if the redirect would work. My host activated wildcard DNS and presto, the code worked. Now on to the real htaccess.