Reputation: 2269
This is currently my entire .htaccess file:
RewriteEngine on
Redirect /index.php /home
RewriteRule ^home$ /index.php?page=home
RewriteRule ^education$ /index.php?page=home&filter=1
RewriteRule ^skills$ /index.php?page=home&filter=2
RewriteRule ^projects$ /index.php?page=home&filter=3
RewriteRule ^experience$ /index.php?page=home&filter=4
RewriteRule ^contact$ /index.php?page=contact
I am currently using the top redirect to redirect: www.codeliger.com/index.php to www.codeliger.com/home to look better. (Is there a better way of doing this?)
The issue is it is also redirecting img.codeliger.com to codeliger.com/home.
How can I prevent the subdomain from being redirected?
Upvotes: 2
Views: 2318
Reputation: 785256
Yes you can replace first rule with:
RewriteCond %{HTTP_HOST} ^(www\.)?codeliger\.com$ [NC]
RewriteCond %{THE_REQUEST} \s/(index\.php)?[\s?] [NC]
RewriteRule ^ /home? [L,R]
RewriteRule ^home/?$ /index.php?page=home [L]
RewriteRule ^education/?$ /index.php?page=home&filter=1 [L]
RewriteRule ^skills/?$ /index.php?page=home&filter=2 [L]
RewriteRule ^projects/?$ /index.php?page=home&filter=3 [L]
RewriteRule ^experience/?$ /index.php?page=home&filter=4 [L]
RewriteRule ^contact/?$ /index.php?page=contact [L]
Upvotes: 3