Php 301将动态url重定向到重写的url
我想重定向所有动态链接以重定向到其重写的url,例如: 到 我的访问权限:Php 301将动态url重定向到重写的url,php,.htaccess,mod-rewrite,url-rewriting,Php,.htaccess,Mod Rewrite,Url Rewriting,我想重定向所有动态链接以重定向到其重写的url,例如: 到 我的访问权限: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /ads-detail.php?location=$1&id=$2&name=$3 [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f Rew
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /ads-detail.php?location=$1&id=$2&name=$3 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/([^/]*)$ /ads-detail.php?id=$1&name=$2 [QSA,L] –
尝试了很多我没有任何解决方案请帮助,提前感谢在您的htaccess中尝试以下内容:
RewriteEngine on
#1) redirect "/ads-detail.php?location=foo&id=123&name=bar" to "/foo/123/bar"
RewriteCond %{THE_REQUEST} /ads-detail.php\?location=([^&]+)&id=([^&]+)&name=([^\s]+) [NC]
RewriteRule ^ /%1/%2/%3? [NC,L,R]
#2) if the requested is not for an existing directory
RewriteCond %{REQUEST_FILENAME} !-d
#3) then rewrite "/foo/123/bar" to "ads-details.php"
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /ads-detail.php?location=$1&id=$2&name=$3 [NC,L]
请共享您的解决方案和当前的htaccess这是我的.htaccess代码重写cond%{REQUEST_FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写规则^([^/]*)/([^/]*)/([^/]*)$/ads detail.php?位置=$1&id=$2&name=$3[QSA,L]重写条件%{请求文件名}-f RewriteCond%{REQUEST_FILENAME}-重写规则^([^/]*)/([^/]*)$/ads detail.php?id=$1&name=$2[QSA,L],实时url为:我想重定向到: