RewriteRule 后如何在地址栏中保留原始 URL

How to keep original URL in addressbar after RewriteRule

这是我的 .htaccess 文件。

Options +FollowSymLinks

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

RewriteEngine on

RewriteRule ^index.html             /? [R=301,L]
RewriteRule ^listen/$               /console [R=301,L]


# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page= [QSA]

重写规则

RewriteRule ^listen/$               /console [R=301,L]

将 url www.mydomain.co.uk/listen 重定向到 www.mydomain.co.uk/console

此重定向工作正常,但我希望地址栏中可见的 url 读取...

www.mydomain.co.uk/listen

非常感谢任何帮助。谢谢

这样说:

Options +FollowSymLinks
RewriteEngine on

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

RewriteCond %{THE_REQUEST} /index\.html [NC]
RewriteRule ^index\.html$ /? [R=301,L,NC]

RewriteRule ^listen/$ /console/ [NC,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page= [L,QSA]

清除浏览器缓存后进行测试。