简单地删除URL段用的.htaccess简单、URL、htaccess

2023-09-02 00:27:53 作者:物是人非

我只是试图让这个网址:

I am simply trying to get this URL:

http://foo.com/entry/random-entry-123

重定向到:

http://foo.com/random-entry-123

随机入境-123是动态的。不同的每个条目。 任何帮助,这是极大的AP preciated!

The "random-entry-123" is dynamic. Different for each entry. Any help with this is greatly appreciated!

推荐答案

假设没有进一步的改写正在使用中,并在所有链接/项/ 要改写,然后试试这个:

Assuming no further rewrites are in use, and all links inside /entry/ are to rewritten, then try this:

RewriteEngine on
RewriteBase /

RewriteRule ^/entry/(.+)$ /$1 [L,QSA]

失去 [L] 如果有进一步重写领先的文件中。

Lose the [L] if there are further rewrites ahead in the file.