如果页面没有指定扩展名而没有将用户实际重定向到实际的URL,是否有一种通用的方式将页面指向另一页?如何在Apache中的URL上没有文件扩展名的情况下执行重定向
e.g.
http://www.mydomain.com/ points to http://www.mydomain.com/public
http://www.mydomain.com/auth points to http://www.mydomain.com/public/auth
http://www.mydomain.com/auth/process points to http://www.mydomain.com/public/auth/process
http://www.mydomain.com/auth/process/done points to http://www.mydomain.com/public/auth/process/done
对不起,没有阅读,起初只有在没有扩展的情况下才想'重定向'。 – Fabian
嗨,感谢您的回复。我会尝试一下,并在几个方面回复你。顺便说一句,你会如此善良的发布规则的确切顺序?对不起,对于htaccess来说真的很陌生。 –
不客气!请使用以下命令: RewriteCond%{REQUEST_URI}!(\。[a-zA-Z0-9] {1,5} |/rewriteCond%{REQUEST_URI}!^ /(public)(。*)$ [NC] )$ RewriteRule ^(。*)$/public/$ 1 [L] 尝试你的规则,你可以用[R]代替[L],这样你就可以看到发生了什么! – Fabian