Paul Stanley
Paul Stanley

Reputation: 4098

.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!

Upvotes: 0

Views: 90

Answers (1)

Olaf Dietsche
Olaf Dietsche

Reputation: 74028

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]

Upvotes: 1

Related Questions