2017-02-26 66 views
0

我想使用我的.htaccess文件,但我仍然无法弄清楚我做错了什么。错误使用.htaccess

我只希望我的域名是yescpol.com.br,它总是这样But I always have this problem

我的.htaccess是文件夹“porcelanato”里面,它有这样的代码:

RewriteEngine on 
RewriteBase /porcelanato/ 

我只想让我的index.php变成yescpol.com.br

我在做什么错?

+0

你可以访问你的Apache配置,这似乎更喜欢用'DocumentRoot'问题设置[见文档(https://httpd.apache.org/docs/2.4/mod/core。 html#documentroot) – Theo

回答

1

最简单的做法是更改域配置中的DocumentRoot或将文件移出该文件夹并移入根目录。

如果你想坚持使用重写方法,你需要添加一个这样的规则。

RewriteEngine On 
RewriteRule ^$ /porcelanato [L] 
0

此行添加到您的.htaccess文件的顶部: DirectoryIndex index.php

但如果这个属性是正确设置你的apache服务在httpd.conf(或无论是您的服务页),这将不会有被添加到你的.htaccess文件。

+0

它没有工作:( – MattDAVM

+0

你能告诉我你的httpd.conf是如何设置的吗?我;特别感兴趣的是看看这个部分是如何在你的apache配置中设置的(如果你使用的是apache) 。 也请告诉我你的配置应该是什么样,指引网站有问题的文档根 # #的DirectoryIndex:定义请求是一个目录 #时,Apache提供服务的文件。# DirectoryIndex index.php index.php3 index.html index.htm Dom