Reputation: 823
I want to make some folder out of root directory (public_html
).
I have shared server linux
with follow directory.
mysite
public_html
tmp
www
and my site directory in my computer(wamp
):
css
js
index.php
htaccess
I want public folder to be placed into public_html
folder in server.
1)how can I include my code using relative paths?
and I have htaccess
file that points all requests to that public/index.php
in my computer.
2)Where should I put my htaccess
in my Shared server linux
?
my htaccess
file:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Upvotes: 1
Views: 8242
Reputation: 143866
You can't traverse out of the document root using relative paths or rewriting in the htaccess file. You can include files from your php script (index.php
). So what you can do is allow a request for something outside of public_html
to be routed to index.php
, then in php, load the file outside of public_html
.
Upvotes: 0
Reputation: 1813
You aplication must be running in this time.
Upvotes: 1
Reputation: 1142
Put everything in
/home/mysite
and configure your virtual host to use
/home/mysite/public/
as DocumentRoot. Put the .htaccess in
/home/mysite/public/
Upvotes: 0