我有一个 URL 重写设置来创建漂亮的 URL
RewriteCond %{REQUEST_URI} !^\/*(index\.php|blog|admin\/assets|site\/assets|robots.txt|sitemap.xml|products.xml|favicon\.ico)
RewriteRule ^(.*)$ /index.php?rq=$1 [L,QSA]
当我使用/admin
URL访问管理区域时,/admin/?rq=admin
因为我有一个名为“admin”的根级目录而被重写。这可能很简单,但是我如何编辑(或添加)我的 .htaccess 规则,以便将 url 清晰地写为/admin/
更新:为了澄清,我想使用/index.php?rq=admin
而不是通过调用 /admin/index.php来访问 /admin
这是我的 apache 虚拟主机配置:
<VirtualHost *:80>
ServerAdmin alex
ServerName hub
ServerAlias hub
DocumentRoot /var/www/hub/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/hub>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>