Reputation: 2471
I am having a bit of trouble with my URL rewrite.
I want to:
rewrite urls with params to slashes
redirect to rewritten urls.
allow for A-Z0-9 directories before test.php in url. right now /test.php only triggers.
example:
a href="test.php?options=1>Click here</a>
when clicked will redirect to url:
test/options/1
OR
abc123/test/options/1 (if the link had abc123/test.php)
and this page will open as the actuall test.php
Existing code:
RewriteRule ^test/(.*)$ /test.php?options=$1
RewriteRule ^test\.php$ /test/options/%1 [L,R=301]
Two problems with above code:
Upvotes: 0
Views: 134
Reputation: 3143
If you simply wanted to redirect /test?options={param} to /test/1/ and /test?options={params} to /test you could do this:
RewriteCond %{QUERY_STRING} ^test=options$ [NC]
RewriteRule ^/test$ /test/options/ [NC,L,R=301]
RewriteCond %{QUERY_STRING} ^test=options$ [NC]
RewriteRule ^/blog$ /test/ [NC,L,R=301]
Upvotes: 1