Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 17th, 2012, 11:37 AM
nachnach's Avatar
nachnach nachnach is offline
<?php print_f(); ?>
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: London
Posts: 1,304 nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 10 h 47 m 49 sec
Reputation Power: 36
Send a message via Skype to nachnach
mod_rewrite - 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]

Reply With Quote
  #2  
Old May 17th, 2012, 11:46 AM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,831 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 1 Day 19 h 9 m 15 sec
Reputation Power: 4192
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. I'm available for hire at Dynamic Site Solutions.

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).

Reply With Quote
  #3  
Old May 18th, 2012, 07:56 AM
nachnach's Avatar
nachnach nachnach is offline
<?php print_f(); ?>
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: London
Posts: 1,304 nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 10 h 47 m 49 sec
Reputation Power: 36
Send a message via Skype to nachnach
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.

Reply With Quote
  #4  
Old May 18th, 2012, 08:07 AM
nachnach's Avatar
nachnach nachnach is offline
<?php print_f(); ?>
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: London
Posts: 1,304 nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level)nachnach User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 10 h 47 m 49 sec
Reputation Power: 36
Send a message via Skype to nachnach
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > mod_rewrite - Changing hosting folder

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap