0

I am working on a school project which includes two pages - Home and View. Basically the home page has a post title and the view page shows post details.

Home page urls is:
https://example.com/

View page url is:
https://example.com/view.php?postid=goodsports

I just want the view page url as:

https://example.com/view/postid/goodsports

or as:

https://example.com/view/goodsports

How can I achieve this using htaccess?

ouflak
  • 2,458
  • 10
  • 44
  • 49
Devil
  • 25
  • 5
  • 2
    Does this answer your question? [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](https://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – CBroe Feb 23 '22 at 15:56
  • 1
    Please also go read [How much research effort is expected of Stack Overflow users?](https://meta.stackoverflow.com/q/261592/1427878) This site is not meant to be a place where you just specify what you need, and someone will write it for you. _You_ are supposed to show some effort first of all. – CBroe Feb 23 '22 at 15:57

1 Answers1

0

Does it look something like this?

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^(.*)$ $1.php
    RewriteRule ^goodsports$ view.php?postid=goodsports [QSA]
</IfModule>
ouflak
  • 2,458
  • 10
  • 44
  • 49
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 23 '22 at 16:33