Reputation: 266
I use .htaccess for Friendly URL, but i have a problem. My subdomain store.domain.com redirect to "/" but, default file is "store.php" and domain.com redirect to "/", default file is "index.php"
i need use if, for example
<If host == 'store.domain.com'>
store rewrite rules
<If host == 'domain.com'>
other rewrite rules different of store
</if>
How i do in .htaccess??
My Htaccess:
IndexIgnore *
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z0-9_-]+)$ store.php?page=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ store.php?page=$1
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?page=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?page=$1
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?page=$1&action=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?page=$1&action=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ store.php?page=$1&action=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ store.php?page=$1&action=$2
Upvotes: 1
Views: 971
Reputation: 866
Please try and research your problem a little more before posting a question on Stack Overflow next time. A simple web search of your problem brings up RewriteCond
statements. Then you could refer to the Apache mod_rewrite documentation.
This documentation would lead you to results, such as:
RewriteCond %{HTTP_HOST} ^store.example.com$
RewriteRule ^([a-zA-Z0-9_-]+)/?$ store.php?page=$1
Upvotes: 2