1

我将如何更改以下 htaccess:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?administration=$1&pid=$2 [L]

不仅影响像这样的网址

www.example.com/administration/modules //this is working allready

但也有像 fe 这样的 url

www.example.com/upload/category

要不就

www.example.com/news

提前感谢,杰登

4

1 回答 1

1

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

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

## If the request is for a valid file
RewriteCond %{REQUEST_FILENAME} -f [OR]
## If the request is for a valid link
RewriteCond %{REQUEST_FILENAME} -l
## don't do anything
RewriteRule ^ - [L]

RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?$1=$1&pid=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ /index.php?pid=$1 [L,QSA]
于 2012-06-05T21:00:33.200 回答