我想制作一个重定向网址
发件人
http://abc.redirect.in/admin/index.php?controller=class&action=add
要
http://abc.redirect.in/admin/class/add
有什么想法吗?
想要删除文字
http://abc.redirect.in/admin/
index.php?controller=
{类{1}}添加
答案 0 :(得分:2)
您可以在/admin/.htaccess
文件中使用此代码:
RewriteEngine On
RewriteBase /admin/
RewriteCond %{THE_REQUEST} /admin/index\.php\?controller=([^\s&]+)&action=([^\s&]+) [NC]
RewriteRule ^ %1/%2? [R=302,L,NE]
# internal forward from pretty URL to actual one
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/.]+)/([^/.]+)/?$ index.php?controller=$1&action=$1 [L,QSA]
答案 1 :(得分:0)
检查一下。 Github上的.htaccess魔术示例:https://github.com/phanan/htaccess