3

我在 wamp 服务器中创建了虚拟。一切正常,但我无法删除 index.php。我不知道如何编写.htaccess。

这是详细信息

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot E:/Projects/OnGoing/bonanza/dev.bonanza.com
ServerName dev.bonanza.com
    <Directory "E:/Projects/OnGoing/bonanza/dev.bonanza.com">
         Options Indexes FollowSymLinks
         AllowOverride None
         Order allow,deny
         Allow from all
    </Directory>
</VirtualHost>

和我的 htaccess

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /

# Allow these directories and files to be displayed directly:
# - index.php (DO NOT FORGET THIS!)
# - robots.txt
# - favicon.ico
# - Any file inside of the media/ directory
RewriteRule ^(index\.php|robots\.txt|favicon\.ico|media|uploads|js|css|images|plugins|source|files|fonts|lib|plugins) - [PT,L]

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php?/$0 [PT,L,QSA]
4

1 回答 1

3

您是否正确设置了主机文件以读取站点的路径?对我来说,我一直使用它在开发服务器中工作正常。

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
于 2013-07-10T05:01:02.117 回答