I once asked this question:
I would like to create redirects so anyone who will enter this URL
mywebsite.com/abc will redirect to mywebsite.com/profile.php?id=abc
mywebsite.com/xyz will redirect to mywebsite.com/profile.php?id=xyz
mywebsite.com/mno will redirect to mywebsite.com/profile.php?id=mno
I was given with the following:
RewriteEngine On
RewriteRule ^([^/]*)$ /profile.php?id=$1 [L]
Every mywebsite.com/profile.php?id=* is being replaced to mywebsite.com/*
Instead of rewriting is it possible to redirect as per my original question?
As I said the only way would be to direct the user to the php script. If you are trying to clean up the look of the URL without even redirecting you could do this:
if (!isset($_GET['id']) {
$uri = array_filter(explode('/',$_SERVER['REQUEST_URI']));
if ($uri[1]) {
$_GET['id'] = $uri[1];
}
}
Then you could access the profile at /profile.php/abc or profile.php?id=abc.