开发者

subdomain htaccess

I have here a subdomain which i wish to pass on.

here the example of url : htt开发者_Python百科p://subdomain.domain.com/login
and it should point to : http://subdomain.domain.com/index.php/login

i write a simple htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php|images|robots\.txt|css|javascript)
RewriteRule ^(.*)$ index.php/$1 [L]

but i always get 500 server error. any body have idea where i wrong?

thanks for any help


It's normal, you go to http://subdomain.domain.com/login, get redirected to http://subdomain.domain.com/index.php/login, then to http://subdomain.domain.com/index.php/index.php/login and so on because you RewriteRule always match.

You can write `RewriteRule ^([^/]*)$ index.php/$1 [L]


Make sure Apache rewrite module is active and your .htaccess file has the following line before any rewrite rule:

RewriteEngine On


Assuming you have mod_rewrite enabled, your RewriteRule causes an infinite redirection loop, which exceeds the maximum number of redirects and causes an internal server error.

You need to condition your rule so it only rewrites once. For example, this should work:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜