Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default htaccess rewrite question

    I know this is way off topic but maybe someone can help me.

    I want to redirect all traffic from an old domain to my zen cart. I have it working...partly. I've got:

    RewriteRule (.*) http://customcreationsunltd.com/shop/$1 [R=301,L]

    which does redirect. But the problem is this, accessing a specific page at the old url, say file.htm redirects to http://customcreationsunltd.com/shop/file.htm but that file does no exist so I get a 404 error.

    How can I get the redirect to redirect all traffic to index.php?

    Thank you!!

  2. #2
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: htaccess rewrite question

    Instead of using 'RewriteRule' it would be better to use RedirectMatch.

    RedirectMatch .* http://customcreationsunltd.com/shop/
    Options -Includes -Indexes -ExecCGI

    Put the above in the .htaccess file for the old Domain. At some point though, you should change your Registrar information for the old Domain to point to 'customcreationsunltd.com' as that is a better way to do permenant redirects of this type.

  3. #3
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: htaccess rewrite question

    Quote Originally Posted by Website Rob View Post
    Instead of using 'RewriteRule' it would be better to use RedirectMatch.

    RedirectMatch .* http://customcreationsunltd.com/shop/
    Options -Includes -Indexes -ExecCGI

    Put the above in the .htaccess file for the old Domain. At some point though, you should change your Registrar information for the old Domain to point to 'customcreationsunltd.com' as that is a better way to do permenant redirects of this type.
    I tried both options and I'm still getting the file name passing to the new url. I hadn't thought about the registrar. There is an option to 'pass directories' and I unchecked that and set forward type to standard. The other option is stealth. The url I'm trying to forard is ccui.net, if that helps at all.

  4. #4
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: htaccess rewrite question

    You've created a bit of a problem for yourself as you're not sure where you want to redirect the old URLs to. Would take some fancy Rewrite code to redirect each individual product, from the old URL to the new.

    Best just to redirect all old URLs to one page explaining about the update and what to do now; such as you've already done with your 404 page. If you don't want them going to your 404 page then create a new page (siteupdate.php or whatever format you want to use) then explain about the changes. This somewhat duplicates your statement on your 404 pages but at least it will cut down on errors showing in your Hosting Error logs.

    You would need to change the .htaccess directive on the old site to:

    RedirectMatch .* http://customcreationsunltd.com/shop/siteupdate.php
    Options -Includes -Indexes -ExecCGI

    Remember, you have a lot of indexed URLs at various sites and to break them needlessly does you no good. If not changing settings at your Registrar then you should use:

    RewriteEngine ON
    RewriteRule ^(.*)$ http://customcreationsunltd.com/shop/siteupdate.php$1 [R=301,L]

    This will allow SEs to update themselves and no negative reaction to your site(s).

  5. #5
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: htaccess rewrite question

    Quote Originally Posted by Website Rob View Post
    RewriteEngine ON
    RewriteRule ^(.*)$ http://customcreationsunltd.com/shop/siteupdate.php$1 [R=301,L]

    This will allow SEs to update themselves and no negative reaction to your site(s).
    The old sites get little traffic anymore and aren't really maintained. Thus the reasont to redirect tehm. I would like to use the 301 for just that reason but can't seem to get it to do that.

    I put that in the htaccess file (I actually used index.php) but it won't load that page. It's still trying pulling the page name from the old url and returning a 404.

  6. #6
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: htaccess rewrite question

    OK, try the following change.

    RewriteRule ^.*(.*)$ http://customcreationsunltd.com/shop/siteupdate.php$1 [R=301,L]

  7. #7
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: htaccess rewrite question

    Thank you but no. Just to be sure I'm not misunderstanding anything, my file is:

    RewriteEngine ON
    #RewriteRule ^(.*)$ http://customcreationsunltd.com/shop/index.php$1 [R=301,L]
    RewriteRule ^.*(.*)$ http://customcreationsunltd.com/shop/siteupdate.php$1 [R=301,L]

  8. #8
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: htaccess rewrite question

    Time to be very specific.


    .htaccess at old site

    RewriteEngine ON
    RewriteRule ^(.*)$ http://customcreationsunltd.com/$1 [R=301,L]

    Send everybody no matter what page they try, to the new site.


    .htaccess at new site

    RewriteEngine On
    # Old Links Redirection - Permanent
    RewriteRule http://ccui.net/.*(.*) http://customcreationsunltd.com/shop/siteupdate.php

    Send everybody no matter what page they were trying at the old site, to the new page.

  9. #9
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: htaccess rewrite question

    I like being specific. But would you believe it doesn't work. This is the htaccess on the new site:

    RewriteEngine On
    # Old Links Redirection - Permanent
    RewriteRule http://ccui.net/.*(.*) http://customcreationsunltd.com/shop/index.php

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


    redirect 301 /first_holy_communion.shtml http://customcreationsunltd.com/firs...itations.shtml
    redirect 301 /anniversary_invitations.shtml http://customcreationsunltd.com/anni...itations.shtml

    Is something in here getting in the way?

  10. #10
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: htaccess rewrite question

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

    Don't understand why you are using the above but can see where it would cause problems.

    Should be written as:

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


    .htaccess file for new site would then look like:

    Options FollowSymLinks

    RewriteEngine ON
    RewriteCond %{HTTP_HOST} ^www.customcreationsunltd.com(.*)
    RewriteRule ^(.*)$ http://customcreationsunltd.com/$1 [R=301]
    # Old Links Redirection - Permanent
    RewriteRule http://ccui.net/.*(.*) http://customcreationsunltd.com/shop/siteupdate.php [R=301,L]
    Last edited by Website Rob; 6 Mar 2008 at 12:36 AM.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. How do I use htaccess to not rewrite a subdomain?
    By Danielle in forum General Questions
    Replies: 3
    Last Post: 15 Feb 2012, 05:04 AM
  2. .htaccess rewrite with folders and Private SSL?
    By littlehawk in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 14 Sep 2009, 07:10 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
  •  
disjunctive-egg