Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

How to make changes on .htaccess file so that it won't keep redirect to my domain website?

Below is the .htaccess file code

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

i try change my RewriteCond %{HTTP_HOST} ^www.example.com$ to RewriteCond %{HTTP_HOST} ^localhost/example$

but it keep loading. How can i make sure it go to my localhost since i want to make some changes?

2 Answers

Can you please post your changed .htaccess?

Common Problems

RewriteEngine on
RewriteCond %{HTTP_HOST} ^localhost/example$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

above is the code i make changes to redirect to my localhost. does it make sense?

But it think, this rule redirects to your localhost.

RewriteCond %{HTTP_HOST} ^localhost/example$.

Try to insert your domain, instead of localhost.