【发布时间】:2011-05-20 03:57:51
【问题描述】:
我目前安装了 SocialEngine,所有 url 都由 .htaccess 文件处理,该文件重定向到 socialengine.php 文件并处理漂亮的 URL 等。
我想阻止 example.com/ 被重定向到脚本,因为我想在那里放置一个不同的索引页面。所以我希望我的 .htaccess 文件处理它无法通过 socialengine.php 脚本找到的所有其他文件,但保持根文件转到 index.php。
所以如果是.com/,它会转到index.php,如果是其他任何东西,它会通过socialengine.php处理。
下面是我需要修改的 .htaccess 文件。
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
# Get rid of index.php
RewriteCond %{REQUEST_URI} /socialengine\.php
RewriteRule (.*) socialengine.php?rewrite=2 [L,QSA]
# Rewrite all directory-looking urls
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*) socialengine.php?rewrite=1 [L,QSA]
# Try to route missing files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} public\/ [OR]
RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
RewriteRule . - [L]
# If the file doesn't exist, rewrite to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ socialengine.php?rewrite=1 [L,QSA]
</IfModule>
提前感谢您的任何回复。
【问题讨论】:
标签: .htaccess url mod-rewrite root socialengine