Results 1 to 6 of 6

Thread: 301 Redirect htaccess

  1. #1
    Join Date
    Jul 2007
    Posts
    4

    Default 301 Redirect htaccess

    Hey guys

    i have a Problem,

    As you know indexu has "http://mysite.com" paths but i wanted to change this to "http:www.mysite.com"

    I tried some htaccess modifications and could get it to work, but when a User clicks on "add a listing" and choose a category. He is redirected back to add.php, i switched back to the original htacces which looks as follows:

    # INDEXU-START
    php_value error_reporting 7
    # DO NOT CHANGE THE FOLLOWING LINES
    # status: 1
    # pattern_category: {$cat_path}/more{$page}.html
    # pattern_detail: detail/{$link_id}/{$link_title}.html

    Options -MultiViews
    RewriteEngine On


    RewriteRule ^detail/(.*)/(.*).html detail.php?linkid=$1
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^.* browse.php

    # INDEXU-END


    So does anybody have perfect piece of code for that 301 Redirect?

  2. #2
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    Place this AFTER # INDEXU-END

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

  3. #3
    Join Date
    Jul 2007
    Posts
    4

    Default

    Bruce i thank you, seems to work fine but when i go to the categories it says 404 "browse.php" not found, do you have any fix for that?


    my .htaccess looks now as follows:

    # INDEXU-START
    php_value error_reporting 7
    # DO NOT CHANGE THE FOLLOWING LINES
    # status: 1
    # pattern_category: {$cat_path}/more{$page}.html
    # pattern_detail: detail/{$link_id}/{$link_title}.html

    Options -MultiViews
    RewriteEngine On


    RewriteRule ^detail/(.*)/(.*).html detail.php?linkid=$1
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^.* browse.php

    # INDEXU-END

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

    EDIT: yes i replaced the "yourdomain.com" with mine

    EDIT2: Cant log into admin panel with the code above
    Last edited by Boxxer; 10-04-2007 at 10:59 PM.

  4. #4
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    The rewrite I gave you won't affect categories, admin or anything else. All it will do is redirect from http://mysite to http://www.mysite

    Perhaps the addition of

    rewriteBase /

    just below # INDEXU-END will fix the issue

  5. #5
    Join Date
    Jul 2007
    Posts
    4

    Default

    When i did this:

    # INDEXU-START
    php_value error_reporting 7
    # DO NOT CHANGE THE FOLLOWING LINES
    # status: 1
    # pattern_category: {$cat_path}/more{$page}.html
    # pattern_detail: detail/{$link_id}/{$link_title}.html

    RewriteBase /

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

    Options -MultiViews
    RewriteEngine On


    RewriteRule ^detail/(.*)/(.*).html detail.php?linkid=$1
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^.* browse.php

    # INDEXU-END

    I could browse trough the categories and everything seems to be ok, but cant login to admin panel to update the category path, i think its the same when a user wants to login with "my account", so maybe anyone has a fix for that? It would be great if other Users here could post their htaccess files in here because my solution doesnt seem to be the perfect one...

  6. #6
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    Here's one of my .htaccess files, it's identical to most of the others that I use other than the domain name.

    # INDEXU-START

    # DO NOT CHANGE THE FOLLOWING LINES
    # status: 1
    # pattern_category: {$cat_path}/more{$page}.html
    # pattern_detail: detail/{$link_id}/{$link_title}.html
    # pattern_tag: tag/{$tag}/more{$page}.html

    Options -MultiViews
    RewriteEngine On

    RewriteRule ^detail/(.*)/(.*).html detail.php?linkid=$1
    RewriteRule ^tag/(.*)/more(.*).html browsetag.php?tag=$1&pg_which=$2
    RewriteRule ^tag/(.*) browsetag.php?tag=$1
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^.* browse.php

    # INDEXU-END

    DirectoryIndex index.php
    Options +FollowSymlinks All -Indexes
    rewriteBase /

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

Similar Threads

  1. 301 redirect
    By spin in forum v5.x
    Replies: 7
    Last Post: 07-23-2007, 12:52 PM
  2. where is .htaccess?
    By jromano in forum v5.x
    Replies: 8
    Last Post: 06-19-2007, 11:21 AM
  3. .htaccess?
    By enginerunup in forum v5.x
    Replies: 6
    Last Post: 09-07-2006, 08:33 AM
  4. [important]302 redirect
    By dody in forum v5.x
    Replies: 20
    Last Post: 05-12-2005, 06:30 PM
  5. Redirect needed
    By Compdoctor in forum v3.2
    Replies: 6
    Last Post: 05-22-2002, 09:46 AM

Posting Permissions

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