2015-12-12 05:00
浏览 35


I'm having a weird problem with my site.

Recently I found that one domain (not mine) was pointing to my IP. My IP hosts a system on Drupal 7 (LAMP) and Ubuntu. My site (still in development and only working in my IP) was already indexed by Google with that other domain name, so I decided to block this site with a simple ".htaccess" trick...

I can't block the "intruder" site using this and that snippet... Frustrated after many tries I wrote some garbage to see if something happened... but everything was still working. Then I erase the .htaccess file in Drupal root... but everything is still working until now.

I've been developing almost 10 years ago, managing small VPSs a few years ago, and when you make a tiny mistake in .htaccess then nothing works! And that's ok! So, as you can imagine i'm lost.

Here is the result when I search for all .htaccess files: enter image description here

My Drupal is installed in /var/www/html

Using the devel module this is part of my phpinfo (as you can see .htaccess is not in Drupal root):

enter image description here

Possibly, I'm making a very stupid mistake, but i've been on this like 2 hours and right now I don't have more places to look at.

I restarted Apache, asumming some kind of unknown cache in the .htaccess file. I also restarted the VPS (Digital Ocean)... No .htaccess file, but my Drupal installation is still working...

I'm missing something terribly... please help!

UPDATE: Every page is still working... also nice URLs. UPDATE 2: I'm attaching how looks 'sites-enabled' folder from Apache with only one file and it's contents.

sites-enabled folder and 000-default.conf contents

图片转代码服务由CSDN问答提供 功能建议


最近我 发现一个域(不是我的)指向我的IP。 我的IP在Drupal 7(LAMP)和Ubuntu上托管了一个系统。 我的网站(仍在开发中,只在我的IP中工作)已经被谷歌用其他域名编入索引,所以我决定用一个简单的“.htaccess”技巧阻止这个网站......

我无法阻止“入侵者”网站使用这个和那个片段...经过多次尝试后我感到沮丧,我写了一些垃圾,看看是否发生了什么......但一切都还在运作。 然后我删除了Drupal root中的.htaccess文件...但是到目前为止一切都还在运行。

我差不多10年前开发了几年前管理小型VPS的工作, 当你在.htaccess中犯了一个小错误时,没有任何作用! 那没关系! 所以,你可以想象我迷路了。

这是搜索所有.htaccess文件时的结果: < / p>

我的Drupal安装在/ var / www / html

使用devel模块这是我的phpinfo的一部分(你可以看到.htaccess是 不在Drupal根目录中):

可能,我犯了一个非常愚蠢的错误 ,但我已经花了2个小时,现在我没有更多的地方可以看。

我重新启动了Apache,在.htaccess中填充了某种未知的缓存 文件。 我还重新启动了VPS(数字海洋)...没有.htaccess文件,但我的Drupal安装仍在工作......


更新:每个页面仍在运行...也是很好的网址。 > > > 2 +我正在附上一个只有一个文件及其内容的来自Apache的“sites-enabled”文件夹 。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • doumouyi4039 2016-01-14 11:38

    Most likely you have some rewrite rules in your VirtualHost configuration and/or apache configuration files. Check all files in /etc/apache2/sites-enabled for any RewriteRules.

    打赏 评论
  • dse3168 2015-12-12 05:13

    Even if .htaccess file is not present home page will load , if you want to stop indexing by google , disallow it in robots.txt file . also u can make an htacesss popup password protection too.Also try to ping the url and see is dev/Production server is giving response if the url's are same .

    打赏 评论
  • drzyeetvt41077335 2016-01-14 16:32

    Well... Finally I discovered my own error.

    I put my rewrite configuration inside /etc/apache2/apache2.conf, probably I had some troubles setting nice-urls at beggining and then I forgot to enabled it properly :/

    I know Drupal can't have nice URLs without these rewrite rules, so they should be somewhere. So I search for the string "RewriteEngine on" and "apache2.conf" came as a result (see the image).

    Now it's solved. My apologies.

    enter image description here

    打赏 评论
  • douwei8911 2016-01-15 06:42

    You could put

    Deny from all
    Allow from your.ip.address 

    in the .htaccess file. That will prevent everyone except you from accessing the site.

    Ref: https://httpd.apache.org/docs/2.2/howto/access.html

    There is also a header which you can add like so:

    Header set X-Robots-Tag noindex,noarchive

    This requests that search engines not index or archive the content. If access is denied, it won't be necessary. Be sure to remove it when the site goes live.

    Ref: https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag?hl=en

    打赏 评论

相关推荐 更多相似问题