Results 1 to 11 of 11

Thread: Forced Redirect

  1. #1
    Join Date
    Aug 2007
    Posts
    268

    Forced Redirect

    Does anyone know of an easy way to avoid people "landing" on a page within your CMS that is not the home page.

    I.e. If a person types www.mydomain.com/thispage.com have them auto redirect to the home page (www.mydomain.com/index.html), where they can then click on a link that will bring them to the page they were looking for.

    I am sure it is possible, but for the life of me, I can't figure it out.

    Cheers.

  2. #2
    You could do a 301 redirect on the particular page to the new url. IIS supports this out of the box. Apache you may have to use the url rewrite module.

    IIS also has a url rewrite module that will do the same, but this is dependent on the access level to the server.

    Either way your host should be able to setup the redirects if they allow it.

    Some hosts don't allow this to limit the number of "sites" you host on one account, usually this is spelled out in the terms of service.
    Last edited by Mike V; 08-20-2009 at 08:22 PM.

  3. #3
    Join Date
    Sep 2002
    Location
    London/Edinburgh
    Posts
    1,131
    Quote Originally Posted by byron7070 View Post
    Apache you may have to use the url rewrite module.
    IIS also has a url rewrite module that will do the same, but this is dependent on the access level to the server.
    While I don't believe a 301 redirect is the best way to solve the issue above it is worth mentioning that you can use PHP to do a 301 direct without having to use an apache module.

    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.domain.com/page/");
    exit();
    ?>
    Europhase UK Limited - XEN/OpenVZ UK/US Virtual Private Servers | R1Soft Backups for Web Hosts
    Custom R1Soft Backups | UK/US Web Hosting | UK/US Virtual Private Servers
    99.9% Uptime SLA | Non Overloaded Service | Guaranteed Ram / Resources
    Company: SC345142 VAT: GB-947754180 Tel: 0870 4710 895

  4. #4
    Yeah, definitely agree 301 redirect is not the most elegant. If you are hosted with a VPS or dedicated server, then a rewrite module is the way to go.

    Unless your host supports those rewrite modules, which would be nice.
    Last edited by Mike V; 08-20-2009 at 08:49 PM.

  5. #5
    Join Date
    Sep 2002
    Location
    London/Edinburgh
    Posts
    1,131
    Quote Originally Posted by byron7070 View Post
    Yeah, definitely agree 301 redirect is not the most elegant.
    No. A 301 redirect is completely unsuitable and will not work for the situation described by Timelord_ above.
    Europhase UK Limited - XEN/OpenVZ UK/US Virtual Private Servers | R1Soft Backups for Web Hosts
    Custom R1Soft Backups | UK/US Web Hosting | UK/US Virtual Private Servers
    99.9% Uptime SLA | Non Overloaded Service | Guaranteed Ram / Resources
    Company: SC345142 VAT: GB-947754180 Tel: 0870 4710 895

  6. #6
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    5,842
    Quote Originally Posted by ThomasC View Post
    No. A 301 redirect is completely unsuitable and will not work for the situation described by Timelord_ above.
    Yes, if we take Timelord's example of a visitor landing on thispage.html, being redirected to index.html and then expecting to follow a link back to thispage.html, a 301 permanent redirect is totally wrong. The browser (if it's behaving correctly) should cache the redirect on the first visit, making it impossible to get to the page.

    A 302 (temporary) redirect shouldn't be cached, so it's a better bet. Even then I wouldn't be entirely surprised to find some browsers caching it for a short time. Perhaps a javascript redirect might be another option.

    Either way, the other problem with this scheme is how you decide whether the visitor is landing on the page for the first time or not. The usual way to test is using the referrer header, which is easily faked by anyone who wants to bypass your controls, and will be blank for many genuine visitors. Still, provided you look specifically for a referrer that isn't your site it can work for the majority of visitors.

    Implementation by mod_rewrite in .htaccess or PHP, as already mentioned.
    Chris

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

  7. #7
    What you have mentioned would be extremely difficult to setup and get to work correctly.

    Another issue you will encounter will be with search engines. Funny redirects are never a good idea if you plan to rank well.
    Eleven2 Web Hosting - World-Wide Hosting, Done Right!

  8. #8
    If you have 301 redirect on the side of the server I suppose that will not affect your SEO. On the SEO forums that is believed to be one of the best way for the SEO

  9. #9
    Join Date
    Aug 2007
    Posts
    268
    Thanks for all the info guys! It's appreciated.

  10. #10
    Join Date
    Dec 2007
    Location
    Indiana, USA
    Posts
    16,087
    Quote Originally Posted by Timelord_ View Post
    Thanks for all the info guys! It's appreciated.
    I am slightly curious as to why you wanted to do this/what you think the benefit would be? I'm not giving you a hard time or anything - just curious
    Michael Denney - MDDHosting LLC
    New shared plans for 2016! Check them out!
    Highly Available Shared, Premium, Reseller, and VPS
    http://www.mddhosting.com/

  11. #11
    Join Date
    Aug 2007
    Posts
    268
    I run a free web hosting business, along with a paid hosting business. My analytics tell me that a LOT of people are heading straight to the order form, bypassing my home page, which has all of the advertising that keeps the business afloat.

    Cheers,

Similar Threads

  1. What is Forced Ads ?
    By Genie in forum Web Design and Content
    Replies: 4
    Last Post: 06-14-2006, 06:23 PM
  2. Forced Ads
    By Rasher in forum Programming Discussion
    Replies: 9
    Last Post: 11-25-2005, 06:00 PM
  3. IP Redirect / Country Redirect.
    By alma714 in forum Web Hosting
    Replies: 1
    Last Post: 12-25-2004, 03:19 PM
  4. Forced Ads?
    By SFA-Dark in forum Web Hosting
    Replies: 4
    Last Post: 04-01-2004, 10:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •