Answer the question
In order to leave comments, you need to log in
Change display path in browser address bar with .htaccess?
- .htaccess is located in dir1 and contains the string DirectoryIndex /file1.php
- file1.php is located in the root of the site
When accessing domain/dir1 , the file file1.php is loaded, the address in the address bar remains the same as domain/dir1 .
The sequence of actions, so that in the address bar, when visiting domain/dir1 , the line changes to domain/dir1/file1.php , can anyone tell me?
Answer the question
In order to leave comments, you need to log in
you need to add two rules:
1) RedirectMatch 301 /dir1/?$ /dir1/file1.php [L, QSA]
2) RewriteRule ^/dir1/file1.php$ /file1.php [L, QSA]
i.e. first redirect to the address you need, then rewrite to the file you need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question