简体   繁体   中英

Redirect without changing Url htaccess

I'm wondering if this is possible - I have projects structured like:

www.mydomain.com points to MyFolder on server. In MyFolder i have 3 App Folders eg MyFolder/App1, MyFolder/App2..

Each of these are 3 different web applications. Url of domain is www.mydomain.com Is it possible, that, when url user go to mydomain.com, it automatically redirect to mydomain.com/App1 but without url change visible to user (in browser it will still be mydomain.com)? I can not point domain to MyFolder/App1 because that way app2 is not accessible. My solution is that app1 becomes a root which contains app2,app3 etc folder but thats just to messy edit: question clarification

You should be able to use this code here.

RewriteEngine on
#ignore App1 and App2 and interally Rewrite to /App
RewriteCond %{REQUEST_URI} !(App1|App2) [NC]
RewriteRule ^(.*)$ /App/$1 [L]

Yes, you should be able to do it in your .htaccess file like this (untested code):

RewriteCond %{HTTP_HOST} ^example.com/App
RewriteRule ^(.*) http://www.example.com/App1 [P] 

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