我一直在努力进行一些htaccess重定向。我只是花了一些时间在堆栈上阅读和搜索,却找不到适合我的情况的答案。
我正在将旧客户网站的301重定向到新网站。
这是旧页网址 https://digitalcoinprice.com/index.php?/first-bitcoin 至 https://digitalcoinprice.com/first-bitcoin 我有多个页面要做,这是几个示例:
https://digitalcoinprice.com/index.php?/first-bitcoin
https://digitalcoinprice.com/first-bitcoin
index.php?/msd index.php?/bitcoin index.php?/ripple
所有这些都链接到不同的新页面。
这是我尝试过的:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^.*/index\.php RewriteRule ^(.*)index.php$ /$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L]
我得到正确的重定向,但是URL保留了这样的查询字符串: https://digitalcoinprice.com/?/first-bitcoin 它不起作用(仍然具有查询字符串)
https://digitalcoinprice.com/?/first-bitcoin
谢谢!