Lewy
Lewy

Reputation: 615

Redirect URL with htaccess

A third party plugin returns to an incorrect URL from a call to save a change.

The URL is /admin/?page=configure/admin/. The correct return should be to /lists/admin/?page=configure. My attempt to write a redirect failed with a 500 server error.


    RewriteEngine On  
    RewriteRule ^(.*)/admin/(.*)$ $1/lists/admin/$2 [NC,L]

How can I correct this code?

Upvotes: 1

Views: 27

Answers (1)

AbsoluteƵERØ
AbsoluteƵERØ

Reputation: 7870

This should work.

RewriteEngine On
RewriteCond %{REQUEST_URI} !^lists
RewriteRule ^(.*/)?admin/(.*)$ $1lists/admin/$2 [QSA,L]

If you want to match a different folder to redirect to admin you will have to declare it literally as a pattern like ^(.*)?/admin would also match lists/admin and cause a loop.

Upvotes: 1

Related Questions