我寫過htaccess文件。我想將https://example.com/index.php?route=product/category&path=1重定向到https://example.com/fashion。PHP網站中的重定向無法正常工作
我的htaccess是
RewriteEngine On
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
但它不是重定向到我已經表明
我寫過htaccess文件。我想將https://example.com/index.php?route=product/category&path=1重定向到https://example.com/fashion。PHP網站中的重定向無法正常工作
我的htaccess是
RewriteEngine On
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
但它不是重定向到我已經表明
你可以使用這樣的事情對所有請求重定向到的index.php,然後管理從請求鏈接有usint * HTTP-PATH。 var_dump($ _ SERVER)查看實際請求。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
如果你想重定向一個特定的請求,那麼其他人可能會在稍後幫你。
你可以使用這樣的東西。我希望這會幫助你很多。如果不工作訪問https://github.com/aice09/htaccess/blob/master/redirects/.htaccess
RewriteEngine On
RewriteRule ^/?category/([^/d]+)/?$ index.php?route=$1 [L,QSA]
我已經寫了這兩行。但結果仍然不起作用。我正在使用opencart進行此操作。 – Prerana
你的htaccess的名稱是否正確?它應該是「.htaccess」而不是htaccess? – Soley
是的,我只寫了.htaccess。它正在閱讀它,如果我做了任何更改 – Prerana