0

I need two things

  1. Redirect all requests from http://127.0.0.1 to http://127.0.0.1/cakephp
  2. Redirect all requests from http://127.0.0.1/somefolder/someaction to http://127.0.0.1/cakephp/somefolder/someaction
  3. Do nothing if request is to this page http://127.0.0.1/cakephp

I tried this but couldn't make it. Can you recommend the right code?

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1/cakephp/$1 [R]
RewriteCond %{HTTP_HOST} ^127.0.0.1 [NC] 
RewriteRule ^(.*)$ http://127.0.0.1/cakephp/$1 [L,R=301] 

1 Answer 1

1

Try:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^127.0.0.1 [NC] 
RewriteCond %{REQUEST_URI} !^cakephp(/.*)?$
RewriteRule ^(.*)$ /cakephp/$1 [R=301,NC,L] 
Sign up to request clarification or add additional context in comments.

1 Comment

no problem. If you want a good reference, corz.org/serv/tricks/htaccess2.php was very helpful for me when I first started writing htaccess redirects

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.