https://example.com/app1
This is my subdirectory and it has one index.html file running on apache server.
I need to redirect all the requests to this directory like https://example.com/app1/*
to https://example.com/app1
without changing the URL.
If user access to https://example.com/app1/test
it should be redirected to https://example.com/app1
but URL should remain same as https://example.com/app1/test
You can use this rule in your public_html/. htaccess
public_html/. htaccess
:
RewriteEngine on
RewriteRule ^app1/((?!index\.html).+)$ /app1/ [NC,L]
Options +FollowSymlinks RewriteEngine on RewriteRule ^([a-zA-Z0-9_-]*)$ index.php [nc,qsa]
This one worked for me.
Thanks to all.
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.