-2

I have centos7 dedi with latest whm/cpanel install I've enabled access to user dirs without domains example http://ip/~user but my target is to be http://ip/user

Now my question would be is it possible to remove ~ and how...? Googled a lot and read a lot but didn't found answer...

2 Answers2

0

You might try this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^\/([^~\/]+?(?:\/.*|$)) /~$1 [L]

Warning: the above will rewrite every url to ~url regardless of if the user exists, so if you go to http://IP/exampleurl it will rewrite that to http://IP/~exampleurl, It only checks if a file or a directory exists there.

Example person
  • 3,198
  • 3
  • 18
  • 45
0

You really should use your hosts file instead of mod_userdir if you're trying to view a site before updating the DNS, or before you have a domain for it.

I can guarantee that mod_userdir will always end up being the unnecessarily difficult solution for this.

This is a guide for using your hosts file instead of mod_userdir: https://docs.cpanel.net/knowledge-base/dns/how-to-modify-your-hosts-file/