开发者

how to send a user back a directory using .htaccess?

okay say I have www.example.com/1/2/

(I can add an index.html if it's needed to make it easier)

However, I want to make sure that the user will get redirected back to this if the above link gets typed in.

www.example.com/1/index.php

(probably didn't need the index.php ?)

I've looked at htacces开发者_JS百科s generators, and it didn't work...

Thanks


You can use mod_alias

Redirect permanent /1/2/ http://example.com/1/

or mod_rewrite

RewriteEngine On
RewriteRule ^1/2/$ http://%{HTTP_HOST}/1/

Add one of the examples to the .htaccess-file in www.example.com/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜