.htaccess subdirectory to subdirectory

2019-09-15 13:24发布

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!

标签: php .htaccess
1条回答
萌系小妹纸
2楼-- · 2019-09-15 14:03

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]
查看更多
登录 后发表回答