htaccess redirect ip/~folder to /var/zpanel/hostdata/zadmin/public_html/folder folder - apache

I am a newbie in the .htaccess language and I would like to achieve the following thing: When an user types an http://ZPANEL-IP/~Website it will show him the contents of the /var/zpanel/hostdata/zadmin/public_html/Website folder. I tried doing that using RewriteCond, but didn't manage to do it, how can I achieve it, and if I do the code, where should I put it? Into Apache's default htacces or into the zpanel's htaccess configuration file?
Thanks in advance.

Related

How to avoid displaying directory path in url?

I set up a little Apache2 server on a Raspberry PI4. Now I’m looking for a way to hide the real directory path displayed in the URL. I read around that you should deal with a file called .htaccess but, I don’t even know what to actually look for on the internet. How can I display an arbitrary url in the address bar of the browser, Hiding file extension like .php and file path?
You make rewrite rules in an Apache config file, a .htaccess file for example. One way you could achieve this is to create re-write rules in a .htaccess file. Use to below link to test your rewrite rules, then once you have that part working implement on your live apache installation.
https://htaccess.madewithlove.be/

.htaccess redirect match to subfolder

I have the present structure now:
www.site.com/reportddmmyyyy
ex:
www.site.com/report01012015
www.site.com/report05012015
and I would like to move all the reports directory into a main directory: reports
www.site.com/reports/reportddmmyyyy
ex:
www.site.com/reports/report01012015
www.site.com/reports/report05012015
Many users have the old format in their bookmarks, so I need htaccess to detect that someone tried to access www.site.com/reportddmmyyyy
and show the content of reports/reportddmmyyyy without changing the browser URL.
Is it possible? I have been Googling for a long time but maybe I am not searching correctly. Could someone please point me in the right way?
RewriteEngine On
RewriteRule ^report([^/]+)/?$ /reports/report$1 [NC,L]
This rule will rewrite
/report01011990
to
/reports/report01011990
without changing the url in your browser.

.htaccess Get rules from an external file

So is it possible to get values from an external file?
Eg.
values.php
echo 'Some rewrite rules';
Is it possible in any way?
I have heard about RewriteMap, but its not for .htaccess
Ps. If you could do some php code in .htaccess or get values from MySQL it would also fix the problem.
Any suggestions?
-Thanks

How to enable urlManager in Yii for virtual directories?

I'm using xampp and tried to put my yii folder and the webapp folder separate from the htdocs directory. I've followed the instructions from here:
http://el.web.id/how-to-add-virtual-directory-alias-on-apache-xampp-165
I was able to run the main page all right, but the other pages just return a not found status. May I know how to fix this? I'm not even sure if the main problem comes from Apache or from Yii. Thanks a lot.
Oh, I get it now. We'd just need to add a rewritebase on the .htaccess file that matches the alias.
RewriteBase /aliasfolder
This is for reference purposes.

Subdomain using .htaccess only

I wanted to know if it is possible to implement sub domain in a web application, only using trick in the .htaccess file? That is avoiding the following
editing the hosts file for the subdomain link
adding a vhost config for the same
Your help be deeply appreciated.
Thanks.
This is not possible by only using an apache directives.
You can add a rewrite command that changes a link to a subdomain.