Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts

    Simple 301 Redirect confusion

    I'm getting conflicting tips on doing 301 redirects in .htaccess. Could someone please help me with these simple steps.

    I want all my u-stu.com pages to redirect to http://www.cineweekly.com specifically and not their corresponding pages.
    Code:
    u-stu.com (with and without www)
     goes to http://www.cineweekly.com
    
    http://www.u-stu.com/images/pic.jpg
     goes to http://www.cineweekly.com
    
    http://cineweekly.com
     goes to http://www.cineweekly.com
    
    
    http://www.cineweekly.com/index.php
     goes to http://www.cineweekly.com
    Last edited by cineweekly.com; 12-18-2010 at 05:12 AM.

  • #2
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Nothing? I'd really appreciate anyone that could help.

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.cineweekly\.com$ [NC]
    RewriteRule ^(.*)$ http://www.cineweekly.com/ [R=301,L]

  • #4
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Thank you so much, no one ever put the ! in there on ANY tutorial and it made all the difference.

  • #5
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    I just noticed a problem with the redirect. When I type in a subdirectory for cineweekly without using www. it takes me straight to the root.

    I want:
    cineweekly.com/images/pic1.jpg to go to http://www.cineweekly.com/images/pic1.jpg not the www root.

  • #6
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by cineweekly.com View Post
    Thank you so much, no one ever put the ! in there on ANY tutorial and it made all the difference.
    try this one:

    http://httpd.apache.org/docs/2.2/rew...ite_guide.html

    and follow links from the box from right side of the page.

    best regards


  •  

    Posting Permissions

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