我有像
这样的动态网址http://epathasala.com/schooldetails.php?name=john-paul-higher-secondary-school
http://epathasala.com/universitydetails.php?name=demo-university
http://epathasala.com/schooldetails.php?name=tagore-international-school
我需要删除所有查询字符串并更改下面的网址
http://epathasala.com/collegedetails/gtn-arts-college http://epathasala.com/universitydetails/demo-university http://epathasala.com/schooldetails/tagore-international-school
我试过[漂亮的网址 - mod_rewrite问题] [1]但是没有用。请一些帮助。感谢
我在htaccess代码下面尝试了这个,但它没有用。
RewriteEngine On
RewriteBase /
RewriteRule ^epathasala/schooldetails/(.*)$ /epathasala/schooldetails.php?name=$1 [NC,L]
我需要删除此部分" .php?name ="来自网址。
答案 0 :(得分:2)
RewriteRule ^(.*?)/(.*?)/?$ $1.php?name=$2 [NC,L]
答案 1 :(得分:0)
这应该有效:
RewriteEngine On
RewriteBase /
RewriteRule ^epathasala/([^/]+)/([^/]+)/?$ /epathasala/$1.php?name=$2 [NC,L]