javascript - Is it possible to extract var from dummy url, use it in meta, but display original dummy url? -


let's have following url: example.com/123456

that url doesn't point - 123456 variable.
php and/or htaccess wonder if can:

  1. get "123456" var
  2. push var meta tag in example.com/index.php
  3. show original url in address bar, display content redirected example.com/index.php (123456 ignored, it's dummy url).

i'm able 1 & 2 htaccess rewrite. have feeling can #3 via javascript, wonder if there's cleaner solution won't make address bar change more needed. also, don't want hacky - wonder if legit process?

here's i've got far .htaccess:

rewriteengine on rewriterule ^([a-za-z0-9\+/=]+)$ ?t=$1 [nc,r=301,l] 

and index.php i'm using:

<meta name="foo" content="https://example.com/<?php echo $_get['t'] ?>" /> 

all works, in order meta var in php, url gets changed example.com/?t=123456. want display dummy url: example.com/123456 show content example.com/index.php

the difference between question , possible duplicate using rewrite. see answer question, mentioned in possible duplicate.

what solved problem use [pt] flag instead of [r=301] flag. [pt] means "passthrough" , allows display new url without changing address. new .htaccess code i'm using:

rewriteengine on rewriterule ^([a-za-z0-9\+/=]+)$ ?id=$1 [nc,pt,l] 

thanks tiny giant helpful link , pointing me in right direction: http://httpd.apache.org/docs/2.4/rewrite/remapping.html


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -