WebFaction
Community site: login faq

I am trying to attempt something that should be pretty easy but I just can't get it working. My experience of Mod_Rewrite is fairly limited.

I have the following site structure:

webapps/myapp/public
webapps/myapp/private
webapps/myapp/.htaccess

I want the .htaccess file to internally redirect all browser requests to the public folder so (with a lot of help from Google) now have this:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^myapp\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/public/ [NC]
RewriteRule  ^(.*)$ /public/$1 [L]

This works fine for e.g. http://myapp.com/index.html?hello=world and the query string is preserved however for http://myapp.com or http://myapp.com/ the browser is redirected to http://myapp.com/public/ and I just don't understand why...

Any pointers gratefully received...

asked 13 Oct '13, 04:51

decoy
12
accept rate: 0%

edited 13 Oct '13, 05:54


Ok, as per the Web Faction Documentation this seems to now be working by adding:

RewriteBase /

immediately after:

RewriteEngine on

I'm sure I tried this before but obviously not...

permanent link

answered 13 Oct '13, 06:58

decoy
12
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×76
×33
×6

question asked: 13 Oct '13, 04:51

question was seen: 1,676 times

last updated: 13 Oct '13, 06:58

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM