02-25-2022, 12:57 PM
|
|
Confirmed User
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,126
|
Quote:
Originally Posted by zijlstravideo
Sure, that's doable.
Your php file, it should look something like this:
$collection = "blah blah something something";
$actual_Link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$post_Link = preg_replace("![^a-z0-9]+!i", "-", strtolower($collection));
$post_Link = rtrim($post_Link, "-");
$rewrite_Link = "http://$_SERVER[HTTP_HOST]/directory/".$post_Link.".php";
if($rewrite_Link !== $actual_Link)
{
header("Location: $rewrite_Link,TRUE,301);
die();
}
And your htaccess something like this:
RewriteRule directory/(.*)\.php$ yourrealfile.php?id=$1 [L]
Not entirely sure about the htaccess part though. It looks a bit off. Anyway, it's untested, but I think it should point you in the right direction.
And make sure you get the value inside $collection from somewhere safe. Might want to check and verify if it's a match in your SQL database or something, before redirecting.
|
Awesome, thanks, will have a play with this shortly 
__________________
SOMETHING EXTREME IS COMING SOON!
|
|
|