开发者

.htaccess conditional redirect question

I'd like to use .htaccess to redirect if there is a particular subdirectory present.

Basically开发者_高级运维, I'd like to redirect http://www.mydomain.com to http://www.mydomain.com/install if the install subdirectory exists.

I know I need to do it with a RewriteCond. So far, this is all I have.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d

I'm not sure what else to do to make this work. Really need help understanding how .htaccess works.

I'd also like to combine it with rewriting to www.

Please help?


This should work, update the path to your install folder in the RewriteCond:

RewriteCond /var/www/domain/htdocs/install -d
RewriteRule .* install/ [L]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜