2015-11-06 125 views
0

我正在编写一个程序并使用xampp在本地运行它。该程序的完整路径是http://192.168.101.103:7777/WeltesMaft/index.php使用.htaccess删除文件的URL

我写在C的.htaccess:\ XAMPP \ htdocs中\ WeltesMaft \含有这种

RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_URI} ^/([^/]+)$ 
RewriteRule .* http://192.168.101.103:7777/WeltesMaft/%1 [L] 

但不知何故,我的htaccess的不工作 。它仍然显示这样的

http://192.168.101.103:7777/WeltesMart/_resources/main.php 

这是在index.php我包括main.php。所以当用户输入index.php时,它会立即重定向到main.php。

我想,这样的URL看起来像这样隐藏它,

http://192.168.101.103:7777/WeltesMart/ 

请帮我我在做什么错在这里...

+1

这不是javascript,php,html或oracle相关 –

+1

你的要求很混乱,似乎没有道理。这来自“http://192.168.100.195:7777/WeltesMart/_resources/main.php”? –

+0

我的不好...对不起。我编辑了我的问题 –

回答

1

您也可以使用此代码.... 。

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ _resources/main.php/$1 [L,QSA] 
</IfModule> 
1

更改RewriteBase到您的目录名和更改htaccess的规则如下,然后再试一次:

RewriteEngine On 
RewriteBase /WeltesMaft 
RewriteCond %{REQUEST_URI} ^/([^/]+)$ 
RewriteRule/index.php [L]