Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008
    Posts
    779
    Tokens
    0

    Default mod_rewrite issue

    The problem is that I've set it up so if you go to http://www.mysite.com/ it redirects to http://mysite.com/. As I want all the domain occurrences in Google to be the same rather than split between the two. Which was easy in itself but I am using SEO urls which include /go/pagename and if you go to say www.mysite.com/go/pagename it redirects to http://mysite.com/pagename.php instead of http://mysite.com/go/pagename and wondering how to get this to work. Here's what I have.

    I'm not a mod_rewrite expert so this may be simple or not but does anyone know how to correct it? Here's my code for it;

    Code:
    RewriteEngine on
    
    RewriteRule ^go/logout/?$ process.php [L]
    RewriteRule ^go/([A-Za-z0-9-]+)/?$ $1.php [L]
    RewriteRule ^go/dashboard/([A-Za-z0-9-]+)/?$ dashboard.php?p=$1 [L]
    RewriteRule ^([A-Za-z0-9-]+)/?$ profile.php?user=$1 [L]
    
    RewriteCond %{HTTP_HOST} ^www.mysite.com [NC]
    RewriteRule ^(.*)$ http://mysite.com/$1 [L,R=301]
    Last edited by Hitman; 18-05-2008 at 07:34 PM.
    Youmeo - Your Social Reunion
    You can follow development at Twitter & visually at Flickr!

  2. #2
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Could use a PHP/Javascript to do it but here
    Code:
    Options +FollowSymLinks
     
    RewriteEngine On
    RewriteBase /
    
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www\.jamesrozee\.com$ [NC]
    RewriteRule ^(.*)$ http://www.jamesrozee.com/$1 [R=301,L]
    http://www.askapache.com/htaccess/mo...nd-tricks.html
    Hi, names James. I am a web developer.

  3. #3
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    Try:

    Code:
    RewriteEngine on
    
    RewriteRule ^go/logout/?$ process.php [L]
    RewriteRule ^go/([A-Za-z0-9-]+)/?$ $1.php [L]
    RewriteRule ^go/dashboard/([A-Za-z0-9-]+)/?$ dashboard.php?p=$1 [L]
    RewriteRule ^([A-Za-z0-9-]+)/?$ profile.php?user=$1 [L]
    
    RewriteCond %{HTTP_HOST} !^www.mysite.com$ [NC]
    RewriteRule ^(.*)$ http://mysite.com/$1 [L,R=301]
    Last edited by Hitman; 18-05-2008 at 07:42 PM.
    How could this hapen to meeeeeeeeeeeeeee?lol.

  4. #4
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    I'm pretty sure if you added:
    Options +FollowSymLinks to the top it may work as you don't need the www then. I may be wrong.

Posting Permissions

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