Joomla:永久从example.com/index.php/foo/bar重定向到example.com/foo/bar(URL中没有index.php)

三岁

.htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

通过此设置,/foo/bar可以在漂亮的URL下访问页面,example.com/foo/bar而丑陋的URLexample.com/index.php/foo/bar仍然有效。我需要实现的是从永久重定向example.com/index.php/foo/barexample.com/foo/bar

RewriteRule .* index.php [R=301,L] 不起作用。

RewriteRule (.*) index.php/$1 [R=301,L]完全相反,它从重定向example.com/foo/barexample.com/index.php/foo/bar请帮帮我!

阿努巴瓦

像这样:

RewriteEngine On
RewriteBase /

# redirect rule to remove /index.php/ from start
RewriteRule ^index\.php(/.*)$ $1 [L,R=301,NC]

RewriteCond %{REQUEST_URI} !^/index\.php [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

从example.com/foo.php永久重定向到example.com/foo分别从example.com/foo.php到example.com/bar

www.example.com 没有重定向到 HTTPS

从www.example.com重定向到www.example.com/index.jsp

Magento,将带有index.php的URL重定向到没有它的URL

我想将 example.com/chapter-foo.php 重定向到 example.com/chapter.php

当我在地址栏中按回车键时,Laravel 6 重定向到 https://www.example.com/index.php,地址为 www.example.com/profile?

htaccess没有重定向到主index.php

重定向到https但没有.php

从example.com/永久重定向到https://www.example.com/dir/

将example.com/index重定向到exmple.com

如何将站点 URL 重定向到 https://example.com

Nginx:将所有内容重定向到http://example.com

在不更改URL的情况下将example.com/abc重定向到example.com/dir?q=abc

.htaccess重定向到example.com,但目录重定向到example.com/example

将http://example.org重定向到http://www.example.org有SEO值吗?

将所有不以example.com/wiki开头的example.com/paths重定向到example.com/wiki-NginX代理

通过.htaccess或php永久重定向大量url-s

重定向301到/如果url包含index.php

如何将所有请求重定向到index.php,即使URL中包含.php

Nginx没有将某些位置重定向到php

.htaccess-将所有URL和现有目录重定向到index.php

重定向到GAE PHP中的外部URL

如何根据PHP中的URL参数重定向到页面?

单击 PHP 中的按钮后如何重定向到 URL

非www到www。重定向并将index.html重定向到index.php

如何在AWS Route 53中将流量从非www域名重定向到www.example.com

PHP-将页面重定向到没有协议的URL?

如何使用htaccess文件将URL从https://example.com/12345.html重定向到https://example.com/product/12345/

htaccess应该从当前URL中删除index.php,而是重定向到root