Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 5 of 5

This is a discussion on Redirect 301 problems in the Shared & Semi-Dedicated forum
G'day, I've just put up a new Etomite CMS base web site to replace an earlier Macromedia Flash based based one. Etomite uses .htaccess file ...

  1. #1
    JPC Addict lloyd_borrett's Avatar
    Join Date
    May 2004
    Location
    Melbourne, Australia
    Posts
    132

    Redirect 301 problems

    G'day,

    I've just put up a new Etomite CMS base web site to replace an earlier Macromedia Flash based based one.

    Etomite uses .htaccess file rewrite rules to implement user friendly URLs.

    So when I came to add in redirect 301 statements for the 6 old web pages of the previous web site, I ended up with the following:

    Code:
    #
    # URL rewriting for Etomite CMS
    # Copyright AAB '04
    #
    # To use friendly URLs for Etomite you need to uncomment the three Rewrite directives
    # Make sure RewriteBase points to the directory where you installed Etomite
    # e.g. / if your installation is in root
    # or /Etomite if your installation is in the Etomite subdirectory
    # 
    #
    # You must be running on Apache with mod_rewrite to be able to use this functionality.
    #
    
    php_flag zlib.output_compression On
    php_value zlib.output_compression_level 5
    
    Redirect 301 /index.html http://www.thetrust.com.au/home.htm
    Redirect 301 /about.html http://www.thetrust.com.au/about-us.htm
    Redirect 301 /bar.html http://www.thetrust.com.au/the-trust-bar.htm
    Redirect 301 /functions.html http://www.thetrust.com.au/functions.htm
    Redirect 301 /restaurant.html http://www.thetrust.com.au/restaurant.htm
    Redirect 301 /weddings.html http://www.thetrust.com.au/weddings.htm
    
    RewriteEngine On
    
    RewriteBase /~jthetrus/
    RewriteCond %{REQUEST_URI} ^.*\.idx$
    RewriteRule ^.*\.idx$ /404.html [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    However, when I then enter any of the old URLs (e.g. http://www.thetrust.com.au/index.html or http://www.thetrust.com.au/about.html), all I ever get is the home page as a result of an error, just as if those redirection statements weren't in the .htaccess file.

    I've tried the following paths in those redirects statements /index.html, index.html, /~jthetrus/index.html without success.

    Can someone please tell me what I'm doing wrong here?

    Best Regards, Lloyd.

  2. #2
    Old Hillbilly Connie's Avatar
    Join Date
    Sep 2001
    Location
    Hills of Missouri
    Posts
    2,648
    Rewrite rules are a little different for PHP I think. This is what I use on my static html site.
    mod_rewrite
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain\.com
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]

    I have never found a way to redirect /index.html to http://www.domain.com.au/home.htm.

    You can use /oldpage.html to http://www.domain.com.au/newpage.htm for individual pages. At least with my kind of site.

    I have to ask why do you want to redirect your main domain to a folder? Your .com.au name is probably the most important realesate you have on the web.

    Did I misunderstand that?

    Redirection of an individual page is not a mod_rewrite though it is a 301 redirect.

    I do know that trying to redirect index.html to the main domain will cause problems. At least it has for me.

    I will be glad to hear the opinions of the Tech Gurus.

    Maybe we can both learn something.
    Last edited by Connie; 12-15-2005 at 08:26 PM.

    Forum Moderators - Jag Staff

    Spam Whackers Blog - Dedicated to fighting Spam and providing General SEO Tips
    Organize your Kitchen or purchase Kitchen Accessories at Condells
    Ihelpyou Forum - Dedicated to "Best Practices" SEO

  3. #3
    || $name ne 'R.Stiltskin'
    Join Date
    Jun 2003
    Location
    Tejas
    Posts
    2,438
    Quote Originally Posted by lloyd_borrett
    ...So when I came to add in redirect 301 statements for the 6 old web pages of the previous web site, I ended up with the following:

    Code:
    #
    # URL rewriting for Etomite CMS
    # Copyright AAB '04
    #
    # To use friendly URLs for Etomite you need to uncomment the three Rewrite directives
    # Make sure RewriteBase points to the directory where you installed Etomite
    # e.g. / if your installation is in root
    # or /Etomite if your installation is in the Etomite subdirectory
    # 
    #
    # You must be running on Apache with mod_rewrite to be able to use this functionality.
    #
    
    php_flag zlib.output_compression On
    php_value zlib.output_compression_level 5
    
    #Redirect 301 /index.html http://www.thetrust.com.au/home.htm
    #Redirect 301 /about.html http://www.thetrust.com.au/about-us.htm
    #Redirect 301 /bar.html http://www.thetrust.com.au/the-trust-bar.htm
    #Redirect 301 /functions.html http://www.thetrust.com.au/functions.htm
    #Redirect 301 /restaurant.html http://www.thetrust.com.au/restaurant.htm
    #Redirect 301 /weddings.html http://www.thetrust.com.au/weddings.htm
    
    Redirect permanent /index.html http://www.thetrust.com.au/home.htm
    Redirect permanent /about.html http://www.thetrust.com.au/about-us.htm
    Redirect permanent /bar.html http://www.thetrust.com.au/the-trust-bar.htm
    Redirect permanent /functions.html http://www.thetrust.com.au/functions.htm
    Redirect permanent /restaurant.html http://www.thetrust.com.au/restaurant.htm
    Redirect permanent /weddings.html http://www.thetrust.com.au/weddings.htm
    
    RewriteEngine On
    
    RewriteBase /~jthetrus/
    RewriteCond %{REQUEST_URI} ^.*\.idx$
    # For any requested document ending in .idx
    RewriteRule ^.*\.idx$ /404.html [L,QSA]
    # return the 404 error document, append the query string, and make
    # this the last rule and quit processing this .htaccess file further
    
    RewriteCond %{REQUEST_FILENAME} !-f
    # If the request is not a file that exists, or
    RewriteCond %{REQUEST_FILENAME} !-d
    # if the file is not a directory that exists, then
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    # store the collected "filename" and place it as a string as part of
    # the query string to the URL - then process through the index.php
    # processed page.
    However, when I then enter any of the old URLs (e.g. http://www.thetrust.com.au/index.html or http://www.thetrust.com.au/about.html), all I ever get is the home page as a result of an error, just as if those redirection statements weren't in the .htaccess file.

    I've tried the following paths in those redirects statements /index.html, index.html, /~jthetrus/index.html without success.

    Can someone please tell me what I'm doing wrong here?

    Best Regards, Lloyd.
    Try this for individual file redirects. It's probably the easiest option despite the limited scalability given your short list of redirected files. I tested to the extent that I could and it works. The "301" versus "permanent" seems like it shouldn't make a difference, but there is some subtlety in it apparently. If it doesn't work, then the Entomite rewrite directives are munging up the requests which causes an error processing sequence to initiate, hence the default index page.

    What I suspect is happening is that, for example, someone asks for http://domain.com.au/index.html and the following occurs:

    Ultimately, the request is redefined to http://domain.com.au/home.htm and the server prepared to send the 301 notification. So far, so good. Now the Apache engine has this new path cached but I don't believe it is quite ready to end processing the request. So, it gets passed on. The domain "base" is redefined and a request for "home.htm" in the URL "/~jthetrus/" (/~jthetrus/home.htm) ensues. The request fails the first conditional so a 404 is not returned (good news). The request proceeds to the next conditional and the file "/~jthetrus/home.htm" does exist (more good news). Having passed the conditional, the final rewrite should not happen and the returned request should proceed as expected; i.e. the POST/GET for "index.html" has been successfully redefined to be one for "home.htm" and the appropriate 301 header with the file forwarded on to the requesting browser.
    Last edited by Spathiphyllum; 12-16-2005 at 02:54 AM.

  4. #4
    JPC Addict lloyd_borrett's Avatar
    Join Date
    May 2004
    Location
    Melbourne, Australia
    Posts
    132
    I'm afraid that made no difference.
    It's got me stumped.

  5. #5
    || $name ne 'R.Stiltskin'
    Join Date
    Jun 2003
    Location
    Tejas
    Posts
    2,438
    Do you have this anywhere in your directory's .htaccess file, or in any .htaccess files in higher level directories?
    Code:
    Options +FollowSymlinks

Bookmarks

Posting Permissions

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