Reputation: 5354
This is my site root
/public_html
beta/
.htaccess
public/
index.php
.htaccess
The first .htaccess inside beta folder is for changing dir from mysite.com/beta to mysite.com/beta/public
:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.mysite.com/$
RewriteCond %{REQUEST_URI} !beta/public/
RewriteRule (.*) /beta/public/$1 [L]
The other.htaccess inside public folder is for shorten url from index.php?photo_id=id
to /id
:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?photo_id=$1
How can I make these work both since for now only one of them work not together? Thanks
Upvotes: 0
Views: 88
Reputation: 143886
For the beta htaccess file, try removing the absolute URLs
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\)?mysite\.com$ [NC]
RewriteCond $1 !^public
RewriteRule ^(.*)$ public/$1 [L]
Note that the trailing slash needs to be removed from the HTTP_HOST, there's not slashes in that variable.
For the public folder, also remove the absolute URLs
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?photo_id=$1
Upvotes: 0
Reputation: 3324
Why do you have "non public" stuff in public_html? If you want it private, shouldn't you place it in a private directory?
Upvotes: 2