-1
我正在使用PHP 5.3.5的Wamp和htaccess
已启用。删除'index.php?'使用.htaccess
我面临的问题是我需要像这样的东西http://localhost/abc/aboutus
。
现在实际的URL是这样的http://localhost/abc/index.php?aboutus
我尝试下面的代码:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
并尝试使用它像http://localhost/abc/aboutus
,但它并不适用于工作。但是当我尝试像http://localhost/abc/?aboutus
。
它工作正常,但我实际上想从URL中删除?
。谁能告诉我我错在哪里?
我认为你需要一个斜杠的模式'^/ABC的前/(.*)$'并删除斜线查询字符串'... $ 1'? –
@OlafDietsche如果规则在服务器或vhost配置中,则只需在模式前面使用斜线。在发送到htaccess文件中的规则之前,斜杠始终从URI中剥离。 –
谢谢您的解释。我不知道这一点。 –