Note that there are some explanatory texts on larger screens.

plurals
  1. PO.htaccess rewrite not working in subdirectory
    primarykey
    data
    text
    <p>My web path is: <code>http://git.example.com/</code> (for example)</p> <p>My doc root is:</p> <pre><code>/home/user/git/ </code></pre> <p>Inside the doc root I have two folders:</p> <pre><code>/home/user/git/john /home/user/git/doe </code></pre> <p>These folders represent the git repos for john and doe respectively. They are hosted on the web server so that code can be tested as its created, before being commited to the master.</p> <p>The problem I'm having is that site code in the repo's have a wordpress-style .htaccess file so that a script can handle all the page slugs as specified in the database for each product etc. I have the following code in my .htaccess file inside the <code>/home/user/git/john</code> directory:</p> <pre><code>RewriteEngine On RewriteBase /john/ # FORCE BROWSER TO URL AND DO NOT ATTEMPT TO SLUG MATCH THESE RewriteCond %{REQUEST_URI} ^/john/checkout/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/john/admin/(.*)$ [OR] RewriteRule ^.*$ - [L] # ROUTE THROUGH CMS RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php </code></pre> <p>I have also tried changing the rewritebase to just <code>/</code> and I have tried changing the last line to <code>RewriteRule . /john/index.php</code> and all variations therein. Nothing I do works.</p> <p>What do I mean by not works? Well say I have the url <code>http://git.example.com/john/some_product_name.html</code> - I get a 404 not found error and the apache error log just has a standard 404 no such file for the request. Nothing more. Its like "no shit the file isn't there... you're suppose to be re-writing this when its not found!"</p> <p>Anyway, this exact script works flawlessly when everything is operating out of the root directory, as it is on the live site, however moving a copy to a subdirectory has been a problem. I could just create a new subdomain for each developer on the project and run git out of their doc_root but really... there should be a way to make this work. What am I missing?</p> <p>Also - I can confirm that the rewrite is not occurring at all because in the top of my <code>index.php</code> file, I have: <code>echo "I'm here"; exit;</code> so instead of getting the 404 not found I should see a blank white page with the message "I'm here". I do not.</p> <p>** UPDATE **</p> <p>I commented out the force through lines at the top like this, and its now working:</p> <pre><code>RewriteEngine On RewriteBase /john/ # FORCE BROWSER TO URL AND DO NOT ATTEMPT TO SLUG MATCH THESE #RewriteCond %{REQUEST_URI} ^/john/checkout/(.*)$ [OR] #RewriteCond %{REQUEST_URI} ^/john/admin/(.*)$ [OR] #RewriteRule ^.*$ - [L] # ROUTE THROUGH CMS RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php </code></pre> <p>Why in the world would those lines be causing this problem? The url I'm accessing definitely does not match either of those patterns!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload