Forum Moderators: phranque
mysite.com/widgets/blue.php?UID=
mysite.com/widgets/blue.php
mysite.com/widgets/blue.php?UID=24
I would like each of them to revert back to the .php. I am also in the process of having my site redesigned and as such the new url will be mysite.com/widgets/blue/
I have been searching and testing different rules for the last three days and haven't been able to find one which works the way I need.
Is this right or am I just doing it wrong.
RewriteEngine On
RewriteCond %{QUERY_STRING} ^UID=([0-9]*)$
RewriteRule ^/widgets\blue\.php$ [mydomain.site...] [R=301,L]
Any help would be appreciated. I have tried to understand the main page here which explains the mod rewrites as well as read through multiple articles to get this to work and it's just not happening.
Thank you in advance
You'll need at least two redirects and one rewrite.
Be aware that RewriteRule, when used in .htaccess, cannot 'see' the leading slash on the requested URL.
You also have a \ where a / should be, in your pattern.
However, when those are corrected, your rule will not do what your example says you require it to do.
That is, a URL request with
UID= and no number in it, will be 301 redirected to http://example.com/widgets/blu[b]e/.p[/b]hp for example.