简体   繁体   中英

.htaccess subdirectory to subdirectory

I've written a web app for an intranet and my links don't sit with the link navigation on the live server. Joy.

I know what you're thinking : write your damned app right. Noted.

I'm wondering if there's a mod_rewrite/htaccess trick that would send me from..

/http://example/[admin/generic]/etc/etc2/this_stays_the_same.file

..to..

/http://example/[src/reports]/etc/etc2/this_stays_the_same.file

..just converting the stuff in square brackets, when I place it in the admin/generic directory.

If there is, that would be neato.

Thanks!

If you enter http://example/src/reports/... into the browser, you can use a simple Redirect

Redirect /src/reports /admin/generic

Update :

If you don't want to show the /admin/generic/... URL in the browser bar, you must do a rewrite instead of a redirect

RewriteEngine on
RewriteRule ^src/reports/(.*)$ /admin/generic/$1 [L]

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