?s=
URL文字列をからに書き直したいのです/search/
が.htaccess
。
例:http://hello.com/?s=hey
=>http://hello.com/search/hey
これどうやってするの?
?s=
URL文字列をからに書き直したいのです/search/
が.htaccess
。
例:http://hello.com/?s=hey
=>http://hello.com/search/hey
これどうやってするの?
このコードをDOCUMENT_ROOTの下の.htaccessに配置します。
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
# external redirect from index.php?s=key to search/key
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?s=([^\s]+) [NC]
RewriteRule ^ search/%1? [L,R,NC]
# external redirect from search/key to index.php?s=key
RewriteRule ^search/(.+)$ index.php?s=$1 [L,NC,QSA]
このようなものかもしれません
RewriteEngine On
RewriteRule ^search/(.*) index.php?s=$1 [QSA,L]
このようにして、次のようにサイトにアクセスします。
http://hello.com/search/hey
として解釈されますhttp://hello.com/index.php?s=hey
お役に立てれば
答えてくれてありがとう、これは私のために働いています、ここから取られました。
RewriteCond %{QUERY_STRING} s=(.*)
RewriteRule ^$ /search/%1? [R,L]