[英].htaccess - How to redirect URL to a folder and then to a PHP file
[英]How to permanently redirect a url with a .htaccess file?
我需要從進行301永久重定向
http://www.example.com/search.php?search=samplesearch
至
http://www.example.com/used/search.php?search=samplesearch [301]
任何幫助,不勝感激。 謝謝
我認為,如果您在stackoverflow中搜索“ redirect htaccess 301 ”,將會找到答案。 如果您想看看它是如何完成的。 使用cPanel創建永久重定向,然后使用文本編輯器或cpanel filemanager打開htaccess文件以查看代碼。 然后,您將知道如何根據需要手動修改htaccess。
將RewriteCond與%{THE_REQUEST}一起使用
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET \/search\.php\?search=samplesearch\ HTTP/ [NC]
RewriteRule ^(.*)$ /used/search.php?search=samplesearch [R=301,L]
有關mod_rewrite變量的更多信息,此站點可能會幫助您: http : //www.askapache.com/tools/mod_rewrite-variables-cheatsheet.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.