Multiple mod rewrite condintions via domain / subdomains
I’ve got a site that handles urls on both domain and subdomain.
Here’s the base htaccess:
#redirect products on head domain
RewriteCond %{HTTP_HOST} ^domain.com
#RewriteCond %{REQUEST_URI} ^.+$ [NC]
RewriteRule ^product/([a-z0-90-]+(/*))$ p.php?i=$1 [L]
RewriteRule ^home(/*)$ home.php [L]#redirect products on sub domain
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain.com [NC]
RewriteRule ^home(/*)$ store.php [L]
So basically, first condition sends home to home.php if no subdomain exists and second sends home to store.php, but it’s not doing that.
I’m probably missing something small here, but my brain is fried atm.
I knew it was something simple… Order counts! Remember the Rule reflects the prior Cond and nothing beyond.
#redirect products on head domain
RewriteCond %{HTTP_HOST} ^domain.com
#RewriteCond %{REQUEST_URI} ^.+$ [NC]
RewriteRule ^home(/*)$ home.php [L]
RewriteRule ^product/([a-z0-90-]+(/*))$ p.php?i=$1 [L]
Check more discussion of this question.
No related posts.
Leave a comment
Recent Posts
- Understanding redundant power supplies
- Is there a way for administrators to disable users from installing Firefox extensions?
- Is there research material on NTP accuracy available?
- How to create a limited “domain admin” that does not have access to domain controllers?
- Can Windows RDC admin users be immune from being kicked?
Tags
active-directory
amazon-ec2
apache
apache2
backup
bash
centos
cisco
command-line
debian
dns
email
exchange
firewall
iis
iis7
iptables
linux
macosx
monitoring
mysql
networking
nginx
performance
permissions
php
postfix
raid
security
sql-server
sql-server-2005
sql-server-2008
ssh
ssl
ubuntu
unix
virtualization
vpn
webserver
windows
windows-7
windows-server-2003
windows-server-2008
windows-server-2008-r2
windows-xp





