www.webdeveloper.com
Results 1 to 2 of 2

Thread: htaccess - redirect and rewrite questions

Hybrid View

  1. #1
    Join Date
    May 2009
    Posts
    129

    htaccess - redirect and rewrite questions

    Hi all,

    I'm trying to avoid duplicate content by editing my htaccess file. I have some pages like www.domain.com/my_page/ and noticed that it wroks for domain.com/my_page

    The links and PR are different on both pages so I wanted to consolidate that by getting some of my pages to add the trailing slash. I tried a 301 redirect like this.

    redirect 301 /my_page http://www.domain.com/my_page/

    I get an error saying that there are too many redirects so it was not possible to complete the redirect. How would I go about getting these trailing slashes added?

    On another note, when I first started link building, I started building on domain.com/store, but have htaccessed my way over to domain.com (although everything still exists in /store). How would I redirect just the domain.com/store/ to domain.com/ to transfer some of that link juice?



    EDIT**

    To clarify...domain.com and domain.com/store and domain.com/store/index.php show the exact same homepage. How would I move the /store and /store/index.php so that it all goes to domain.com when someone tries to visit a /store or /store/index.php?
    Last edited by smoh; 10-02-2010 at 01:36 AM.

  2. #2
    Join Date
    Oct 2010
    Posts
    7
    The trailing slash won't help. What you need to do is decide whether you want to use www or not, then add a line that forwards all www request to non-www or vice versa.

    RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles