Home apache, how to refer to the directory which is a slibling from .htaccess file?
Reply: 0

apache, how to refer to the directory which is a slibling from .htaccess file?

olga
1#
olga Published in 2017-11-14 23:30:17Z

How to refer to the directory which is a slibling from .htaccess file?

In my hosting server, if i use www.somedomain.com, i am served /home/username/public_html/public_index.php.

I would like to put all my project to /home/username/somedomain.com/ and server files from public/index.php using MVC concepts.

I am not able to find .htaccess file which regulates how i parse urls.

1) I need to redirect from /username/public_html/public , to /username/somedomain.com/public?

Thus i put .htaccess to /username/public_html/public

RewriteEngine On
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{ENV:REQUEST_FILENAME} !-d
RewriteCond %{ENV:REQUEST_FILENAME} !-f  
RewriteCond %{ENV:REQUEST_FILENAME} !-l

RewriteRule ^about/(.*)$ /somedomain.com/about171114/public/index\.php?url=$1 [QSA,NC,L] 
#for url https://somedomain.com/about
#does not work

RewriteRule ^about2/(.*)$ /home/username/somedomain.com/about171114/public/index\.php?url=$1 [QSA,NC,L] 
#for url https://somedomain.com/about
#does not work

#currently, the folder does not exists
#RewriteRule ^map/(.*)$ /exm/about/exm170810/public/index\.php?url=$1 [QSA,NC,L]
#for url https://somedomain.com/map

2) i have tried to use alias, to refer from /username/public_html/public to /username/somedomain.com/public, but it also does not work

Alias /tb /username/somedomain.com

RewriteEngine On
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{ENV:REQUEST_FILENAME} !-d
RewriteCond %{ENV:REQUEST_FILENAME} !-f  
RewriteCond %{ENV:REQUEST_FILENAME} !-l

RewriteRule ^about/(.*)$ /tb/about171114/public/index\.php?url=$1 [QSA,NC,L] 
#for url https://somedomain.com/about
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311093 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO