user1768403
user1768403

Reputation: 33

.htaccess mod rewrite, condition issue

For url like: http://sub.domain.com rule from third line should apply. It worked before but on new server it doesn't.

Rules from last two lines for url like: http://sub.domain.com/test works fine.

RewriteCond %{HTTP_HOST} ^(.+?)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^(.*\..*)$
RewriteRule ^/?$ site/index.php?site=%1 [L,QSA]

RewriteCond %{HTTP_HOST} ^(.+?)\.domain\.com$ [NC]
RewriteRule ^([^.]+)/?$ site/index.php?site=%1&page=$1 [L,QSA]

Thank you in advance for any help.

Upvotes: 0

Views: 20

Answers (1)

Jon Lin
Jon Lin

Reputation: 143886

Try changing to:

RewriteCond %{HTTP_HOST} ^(.+?)\.domain\.com$ [NC]
RewriteRule ^(?:index\.php|)$ site/index.php?site=%1 [L,QSA]

RewriteCond %{HTTP_HOST} ^(.+?)\.domain\.com$ [NC]
RewriteRule ^([^.]+)/?$ site/index.php?site=%1&page=$1 [L,QSA]

Upvotes: 1

Related Questions