一个完整的URL重写的.htaccess [英] A complete url rewrite .htaccess

查看:199
本文介绍了一个完整的URL重写的.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个完整的URL重写code(如果多数民众赞成你叫吧),可以改变...

I'm looking for a complete url rewrite code(if thats what you called it) that can change...

http://example.com/index.php?i=main&page=5
http://example.com/administrator/page.php?mod=100&access=granted

http://example.com/main/5
http://example.com/administrator/100/granted

我用,这是其他方法都试过建议在网上,但得到错误500,我不知道哪里出了问题。

I have tried using other method that was suggest online, but getting error 500. I don't know what went wrong.

请帮忙。

推荐答案

尝试:

RewriteEngine On

RewriteCond %{THE_REQUEST} \ /+administrator/page\.php\?mod=([^&]+)&access=([0-9]+)
RewriteRule ^ /administrator%1/%2? [L,R]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^administrator/([^/]+)/([^/]+)$ /administrator/page.php?mod=$1&access=$2

RewriteCond %{THE_REQUEST} \ /+index\.php\?i=([^&]+)&page=([0-9]+)
RewriteRule ^ /%1/%2? [L,R]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([0-9]+)$ /index.php?i=$1&page=$2 [L]

这篇关于一个完整的URL重写的.htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆