开发者

.htaccess conditional redirect question

开发者 https://www.devze.com 2023-03-19 15:35 出处:网络
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

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

精彩评论

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

关注公众号