我的 htaccess 问题 - 重写用户

Issues with my htaccess - rewriting user

用最简单的话来说,我正在尝试将用户从 faq.html 重定向到 Help/Frequently-Asked-Questions。现在下面的代码部分工作。从某种意义上说 url 确实显示了干净的 url,但是无法找到 faq.html 页面本身,因为干净的 url 当它是只是重写。

如有任何帮助,我们将不胜感激。

# Activate rewrite engine

RewriteEngine On

# Establish the base
RewriteBase /

# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} /faq.html [NC]
RewriteRule ^ Help/Frequently-Asked-Questions [R=302,L,NE]

# internal forward from pretty URL to actual one
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^faq.html$ help/Frequently-Asked-Questions [L,QSA]

你的第二条规则是反向操作。就这样吧:

RewriteEngine On
RewriteBase /

# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} /faq\.html [NC]
RewriteRule ^ Help/Frequently-Asked-Questions [R=302,L]

# internal forward from pretty URL to actual one
RewriteRule ^help/Frequently-Asked-Questions/?$ faq.html [L,NC]