#1
  1. <?php print_f(); ?>
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    London
    Posts
    1,304
    Rep Power
    38

    Changing hosting folder


    Hi guys,

    I've been making a few changes to my site, originally I had a php file which would redirect you to the folder hosting my site i.e. /site/ but what I found is that Google wasn't indexing my homepage because of this redirect.

    So, I decided to place this code in a .htaccess file and it works fine for main domain (joharaphotography.com) but I have two domains, the second domain uses cURL to get the same page and display that but when you go that site it takes a looooong time to load or sometimes it fails all together.

    Can anyone help me fix this please?


    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?joharaphotography.com$ [OR] 
    RewriteCond %{HTTP_HOST} ^(www.)?joharagroup.com$
    RewriteCond %{REQUEST_URI} !^/
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /site/$1
    
    RewriteCond %{HTTP_HOST} ^(www.)?joharaphotography.com$ [OR] 
    RewriteCond %{HTTP_HOST} ^(www.)?joharagroup.com$
    RewriteRule ^(/)?$ site/index.php [L]
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4304
    The first thing to do is move specific directives before more general ones.
    Code:
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^(www.)?joharaphotography.com$ [OR] 
    RewriteCond %{HTTP_HOST} ^(www.)?joharagroup.com$
    RewriteRule ^(/)?$ site/index.php [L]
    
    RewriteCond %{HTTP_HOST} ^(www.)?joharaphotography.com$ [OR] 
    RewriteCond %{HTTP_HOST} ^(www.)?joharagroup.com$
    RewriteCond %{REQUEST_URI} !^/
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /site/$1
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. <?php print_f(); ?>
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    London
    Posts
    1,304
    Rep Power
    38
    Thanks, I think has done the trick for the load speed but I've just been testing the site on different machines and from my work PC when I go to joharaphotography.com the URL stays as it is i.e. no /site/ but from my home PC it redirects to the /site/ folder.

    Any idea why this happening? Because I don't want the /site/ to be displayed in the URL.

    Thanks.
  6. #4
  7. <?php print_f(); ?>
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    London
    Posts
    1,304
    Rep Power
    38
    Ah, its not the .htaccess file, this is a cache issue with Firefox, it had stored the 301 redirect I had.

    Deleted cache, all sorted

IMN logo majestic logo threadwatch logo seochat tools logo