php - joomla .htaccess 中的重写规则不起作用

标签 php .htaccess mod-rewrite joomla

我在 joomla .htaccess 中添加了这一行以删除部分 url。

原始 URL 示例 - http://odishayellowpages.in/item/scientific-suppliers

必需的 URL 示例 - http://odishayellowpages.in/scientific-suppliers

我已经使用了这个重写规则 - 但它没有任何区别。

# Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
RewriteRule ^item/(.*)$ $1 [R=301,L]
## End - Custom redirects

最佳答案

您可以在 RewriteEngine On 行下方使用此重定向规则:

RewriteRule ^item/(.*)$ /$1 [R=301,L,NC,NE]

您需要在目标 URL 的开头使用 / 以避免它被附加到当前文件系统路径。

关于php - joomla .htaccess 中的重写规则不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39142710/

相关文章:

regex - .htaccess 重定向 : convert path to GET variables?

php - jQuery 尝试加载不存在的 ajax-loader.gif mod-rewrite 不起作用

php - 使用php获取字符串中的第一张图片

PHP - error_reporting 不起作用

php - Openshift 将 wp-admin 重定向到 https

php - PHP 头函数的替代品

WordPress 404 模板是否覆盖了我的 .htaccess 设置以解决 404 错误?

php - 目录重定向规则

php - mock Eloquent 集合

php - 未定义类常量 'MYSQL_ATTR_INIT_COMMAND' 与 pdo