.htaccess - 只需使用 .htaccess 删除一个 url 段

标签 .htaccess mod-rewrite redirect

我只是想获取这个 URL:

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

重定向到:
http://foo.com/random-entry-123

“random-entry-123”是动态的。每个条目不同。
非常感谢您对此的任何帮助!

最佳答案

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

RewriteEngine on
RewriteBase /

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

丢了[L]如果文件中有进一步的重写。

关于.htaccess - 只需使用 .htaccess 删除一个 url 段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4823870/

相关文章:

.htaccess - 将http://www.youtube.com重定向到https

php - SSL 网站在子 URL 中附加 https

apache - 301 重定向不适用于索引文件

.htaccess - 如果 rewriterule true 则停止处理?

wordpress - 如何使用 WordPress Multisite 重定向特定站点的主页

.htaccess - 允许使用 htaccess 文件使用多个 IP 地址进行管理员登录

.htaccess - https 阻止谷歌 adsense 广告展示?

php - 启用 .htaccess 时 Joomla 3.8 出现 404 错误

ruby-on-rails - Ruby on rails,强制用户下载 tmp 文件

redirect - 有趣的SEO场景——某网站的301部分