douyin2883 2013-03-19 11:00 采纳率: 0%
浏览 52

Html - PHP - 机器人

I am just looking for a bit of advice / feedback, I was thinking about setting up and opencart behind an HTML site (shop) that gets ranked well in Google.

The index.html site appears instead of the index.php page by default on the web server (I have tested it).

I was hoping I could construct the site in maintenance mode on the domain, then just delete the html site leaving the (live) opencart site once finished (about 2 weeks).

Just worried in case this may effect ranking.

In the robot.txt file put:

User-agent: *
User-agent: Googlebot

Disallow: /index.php

I would also put in the index.php page (opencart) header:

<meta name="robots" content="nofollow">
<meta name="googlebot" content="noindex, noarchive">

I don't want Google to cache the "website under maintenance" opencart index.php page. It could take a month or so to refresh it.

Obviously I would remove/change the Disallow robot.txt and meta tag etc commands once live and html site files deleted.

I would like to know if any one has tried it or if it will work? Effect google ranking etc?

Is it just a Bad idea? Any feedback would be appreciated.

Many Thanks

  • 写回答

1条回答 默认 最新

  • doujin4031 2013-03-19 11:22
    关注

    I assume you're using LAMP for your website (Linux, Apache, MySQL, PHP)

    1) Apache has option to set default page, set it to index.php instead of index.html

    2) You may either use re-write rule in .htaccess file (read more here. If your hosting provider doesn't give permission to .htaccess, there's a workaround!
    In index.php you may include this snippet at the top:

    <?php
    if($_SERVER['REQUEST_URI'] == '/index.php'){
        header("HTTP/1.1 301 Moved Permanently");
        header("Location: /");
        die();
    }
    ?>
    

    So even if user opens up http://www.domain.com/index.php,
    he'll get redirected to http://www.domain.com/

    (Eg: My site http://theypi.net/index.php goes to http://theypi.net/)

    I've also set similar redirect for http://www.theypi.net to redirect to http://theypi.net
    Choosing between one of the two options (with or without www) helps improve ranking as well)

    To your question

    I would like to know if any one has tried it or if it will work? Effect google ranking etc?

    1. Shorter URL: This is part of URL hygiene which is meant for SEO improvement
    2. If homepage opens just through domain name (without index.php) then your CTR (Click Through Rate) impact in search results is higher.

    I would suggest not to use robot blocking mechanism unless above steps aren't feasible for you.

    Hope it helps, Thanks!

    Edit:
    And if you don't even have permission to set homepage as index.php. You may do one of following:
    1. create index.html and put php code. If WebServer understands php, put redirect logic as above.
    2. else, put JavaScript redirect (not a recommended way)
    <script language=”JavaScript”> self.location=”index.php”; </script>

    评论

报告相同问题?

悬赏问题

  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?