Hello,
I am trying to set up a redirect on my site and not having much luck. I can "hard code" it like below:
Redirect 301 /profile/myuserid http://www.domain.dom/profile.php?user-id=myuserid
And that works. But, I would like it to:
a) display in the browser as "http://www.domain.dom/profile/myuserid" instead of "http://www.domain.dom/profile.php?user-id=myuserid"
b) work using variables instead of hard coding each actual user ID into the .htaccess file.
Additionally, if there is an actual directory at /profile/myuserid, I would like that to be displayed instead of redirecting/rewriting the dynamic URL.
Hopefully, that all makes sense.
I've searched different places online and tried numerous variations but nothing has worked so far. Some have blocked the whole website from working while others seem to do nothing at all.
The most recent is this:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^/profile/([^/]+) http://www.domain.dom/profile.php?user-id=$1 [NC]
I'm not sure where to go next. I probably spent a good afternoon trying to get it to work, which ended with me eMailing my host to see if mod_rewrite was set up on the server. (It is.)
Thanks!