Link to home
Start Free TrialLog in
Avatar of ddantes
ddantesFlag for United States of America

asked on

WampServer loads my remote site, not local files

Running WampServer on a Windows 7 platform, I can't access my local files.  Instead of loading localhost, WampServer loads my remote-hosted site pages.  The last time I used WampServer was months ago, and it worked correctly.  I've made changes to the system since then, and don't know what went wrong.
Avatar of Gary
Gary
Flag of Ireland image

How are you trying to access localhost?
Have you made any changes to your hosts file to do any redirects?
Avatar of ddantes

ASKER

Thank you for your comment.  I try to access localhost by directing my browser to http://localhost/ 

Yesterday,  I modified .htaccess to perform some redirects.  However, if I remove .htaccess from my local folder and my server, the behavior doesn't change.
What is it you are loading locally - WP, Joomla or something similar? There may be a redirect happening because the base url is set to your live site
Avatar of ddantes

ASKER

I was mistaken about .htaccess -- it is causing this issue.  I modified it yesterday to redirect certain requests.  The pre-modification version allows WampServer to connect to localhost.  Can you advise me what I should change in .htaccess so that the redirect remains effective, and localhost is also accessible?  Here is the code which I added yesterday:

# redirect requests with www prefix
RewriteEngine on
RewriteCond %{HTTP_HOST} !^mauitradewinds.com [NC]
RewriteRule ^/?(.*)$ http://mauitradewinds.com/$1 [L,R=301]

RewriteEngine On
RewriteBase /

# redirect index.htm to the root domain
RewriteRule ^index\.htm$ / [NC,R,L]
That redirects everything that doesn't start with mauitradewinds.com
Try
RewriteCond %{HTTP_HOST} !^localhost
RewriteCond %{HTTP_HOST} !^mauitradewinds.com [NC]
RewriteRule ^/?(.*)$ http://mauitradewinds.com/$1 [L,R=301]1

Open in new window

Avatar of ddantes

ASKER

I get an error: RewriteRule: bad flag delimiters

Here is the revised .htaccess code:

# redirect requests with www prefix
RewriteEngine on
RewriteCond %{HTTP_HOST} !^localhost
RewriteCond %{HTTP_HOST} !^mauitradewinds.com [NC]
RewriteRule ^/?(.*)$ http://mauitradewinds.com/$1 [L,R=301]1

# redirect index.htm to the root domain
RewriteEngine On
RewriteBase /
RewriteRule ^index\.htm$ / [NC,R,L]
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial