php - How to Display 1 of 2 parameters passed in URL with htaccess? -


I currently have something What is the HTXus code that redirects

  localhost / category.php? Id = some more phrases = which   

to

  localhost / id / phrase   

what I have to do now Adds additional code which will display only one of the parameters in the URL for a different page, which is called article.php, it is only

  localhost / article / id   

Note that I want to cut the phrase parameter from the above URL, and display only the id segment. I currently have the full code in the .htaccess file with me:

  options + rewrite the follow up script on the envato revetabab / # external redirect from /category.php?id=name&phrase = Sthing to / name / some rewriteconds% {THE_REQUEST} \ s / + category \ .php \? Id = ([^ & amp;; + +)) and phrase = ([^ \ & amp;; ++]) [NC] rewrite ^ ^% 1 /% 2? [R = 302, L] RewriteCond% {REQUEST_FILENAME} -d [OR] Rewrite Convert% {REQUEST_FILENAME} -f Rewriting Rule ^ - [L] # clears all articles, rewriting files and directories by rewriting files, And the wrestler pages RewriteRule ^ /? Article / ([^ /] +) /? $ Article.php? Id = $ 1 [L, QSA] rewrite rule / wrestler / ([^ /] +) /? $ Wrestler.php? Id = $ 1 [L, QSA] removes the .php extension from #pages RewriteCond% {DOCUMENT_ROOT} / $ 1.php -f [nc] REGULATION RULES ^ (. +?) /? $ $ 1.php [L] Rev. Raul ^ ([^ /] +) / ([^ /] +) /? $ Category.php? Id = $ 1 and phrase = $ 2 [L, QSA]   

Any ideas people?

Most people do something like this:

  rewrite cnd% {REQUEST_FILENAME} }! -f Rewrite% {REQUEST_FILENAME}! -d Recruitment Rule ^ (. *) $ Router_script.php? And then their router script does something like this:  
  $ Args = explosion ('/', $ _SERVER [''] = $ 1 [L]   

QUERY_STRING ']); Switch ($ AGR [0]) {case 'article': $ _GET ['id'] = isset ($ args [1])? $ Args [1]: ''; Include "Articles.php"; break; }

There are more elegant approaches than that, but it can do the trick.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -