我是 mod_rewrite 的新手,到目前为止一直在反复试验,我想将所有 URL 请求重定向到 /drupal-6.13/ 并隐藏 /drupal-6.13/,但如果 URL 是 www.site .com/wiki 不要重写任何东西。我还在 drupal 中使用 pathauto mod 为故事内容创建 /content/title 链接。我认为这是重写 URL 的顶部和底部 htaccess 中的最后一部分,因为 www.iamthelaw.net/wiki 被重写为http://www.iamthelaw.net/wiki/?q=wiki,但是如果我尝试删除他们的管理链接和内容链接不再起作用。有什么我可以添加的,而无需删除当前仅用于 /wiki/ 请求的内容吗?
这是顶层的 htacess:
Options -Indexes
RewriteEngine on
Options +FollowSymLinks
#site
RewriteCond %{HTTP_HOST} ^www\.iamthelaw\.net$ [NC]
RewriteCond %{REQUEST_URI} !^/drupal-6.13
RewriteRule ^$ /drupal-6.13/index.php [L]
#files
RewriteCond %{HTTP_HOST} ^www\.iamthelaw\.net$ [NC]
RewriteCond %{REQUEST_URI} ^.*\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_URI} !^/drupal-6.13/
RewriteRule ^(.*)$ /drupal-6.13/$1 [L,QSA]
#url 's
RewriteCond %{HTTP_HOST} ^www\.iamthelaw\.net$ [NC]
RewriteCond %{REQUEST_URI} !^/drupal-6.13
RewriteRule ^(.*)$ /drupal-6.13/index.php?q=$1 [L,QSA]
并在子文件夹 /drupal-6.13/ 中的 htacess 的重写部分:
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /drupal-6.13
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ /drupal-6.13/index.php?q=$1 [L,QSA]
</IfModule>