Let's say I have the following url: example.com/123456
That url doesn't point to anything - the 123456 is a variable.
With PHP and/or htaccess I wonder if I can:
- get the "123456" var
- push the var into a meta tag in example.com/index.php
- show the original url in the address bar, but display content redirected from example.com/index.php (123456 is ignored, it's just a dummy url).
I'm able to do 1 & 2 with an htaccess rewrite. I have a feeling I can do #3 via javascript, but I wonder if there's a cleaner solution that won't make the address bar change more than needed. Also, I don't want to be hacky - I wonder if this is a legit process?
Here's what I've got so far with .htaccess:
RewriteEngine on
RewriteRule ^([A-Za-z0-9\+/=]+)$ ?t=$1 [NC,R=301,L]
And for the index.php I'm just using:
<meta name="foo" content="https://example.com/<?php echo $_GET['t'] ?>" />
All this works, but in order to get the meta var in php, the url gets changed to example.com/?t=123456. I want to display the dummy url: example.com/123456 but show content from example.com/index.php
The difference between my question and the possible duplicate is that I already am using rewrite. See also the answer to my question, which is nowhere mentioned in the possible duplicate.