简体   繁体   中英

htaccess https://example.com/dash/something link redirect problem

I have some directories:

/
/dash
/something

I want to make htaccess to redirect all traffic to it's subfolder index.php , which i did, when i type it works example.com/dash or example.com/something

But my problem is when i try something like this example.com/dash/login or example.com/dash/another in this case i'm redirected to / directory

Here is my htaccess in / directory

https:// we.tl/t-NtTDlYKBHr

Options -Indexes -MultiViews +FollowSymLinks
RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(?!dash/)(.+)$ /index.php?u=$1 [NC,QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^dash/(.+)$ /dash/index.php?u=$1 [NC,QSA,L]

And in /dash

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?path=$1 [NC,L,QSA]

https:// we.tl/t-lhgQ03tTGE

I am not expert on this. but I think you achieve it by something like this.
put this file in your parent directory

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^none/ none/index.php [NC,L,QSA]
RewriteRule ^dash/ dash/index.php [NC,L,QSA]
RewriteRule ^something/ something/index.php [NC,L,QSA]
RewriteRule ^ index.php [NC,L,QSA]

also if you put htaccess in every directory you may use this in all directories.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [NC,L,QSA]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM