The file .htaccess has this directive:
RedirectMatch permanent ^$ /moby/
When I type the website address into the address bar in the browser: http://mobyx.net/
it appears the directory redirected to: http://mobyx.net/moby/
How to hide the directory?
You are currently doing a redirect (you tell the client to try again on mobyx.net/moby
if they go to mobyx.net
). What you actually want to do is an internal rewrite. This is invisible to the client. You can use RewriteRule
for that. See the documentation for more information.
First make sure that mod_rewrite
is enabled in httpd.conf. Then add the following to your .htaccess
RewriteRule ^$ /moby/ [L]
This will internally rewrite http://mobyx.net/
to http://mobyx.net/moby/
, but not http://mobyx.net/index.php
for example. If you want everything to be rewritten on your site, use:
RewriteCond %{REQUEST_URI} !^/moby
RewriteRule ^(.*)$ /moby/$1 [L]
This will rewrite the url if it doesn't already point to the /moby subdirectory.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.