2

我有这个链接 http://xxxx.com/yyyy/index.php?class=Applications&function=create

我想让它看起来像这样

http://xxxx.com/yyyy/create

我知道我必须使用

重写引擎开启

重写规则 ....

但由于我是新手,我不知道如何格式化它..

DirectoryIndex index.php order deny,allow Options +FollowSymLinks -MultiViews

 RewriteEngine On RewriteBase /
 RewriteRule ^(XXXXXXXX)/(aaaa)/?$ $1/index.php?class=Applications&function=$2 [L,NC,QSA] 
RewriteRule ^(XXXXXXXX)/(bbbb)/?$ $1/index.php?class=Applications&function=$2 [L,NC,QSA] 
RewriteRule ^(XXXXXXXX)/(cccc)/?$ $1/index.php?class=Applications&function=$2 [L,NC,QSA] 
RewriteRule ^(XXXXXXXX)/(dddd)/?$ $1/index.php?class= test&function=$2 [L,NC,QSA] 
RewriteRule ^(yyyy)/index\.php$ $1 [L,NC]  #this one is not working...
4

2 回答 2

1

通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccessDOCUMENT_ROOT目录下:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^(yyyy)/(create)/?$ $1/index.php?class=Applications&function=$2 [L,NC,QSA]
于 2012-06-04T19:01:22.030 回答
0
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /yyyy/
    RewriteRule create index.php?class=Applications&function=create
</IfModule>
于 2012-06-04T16:15:06.243 回答