0

I don't want to make a single page that will handle all the posts like the URL:

somewebsite.com/blog.php?blog=2232

I want that every blog should appear like:

somewebsite.com/blog1/

somewebsite.com/blog2/

For example, WordPress displays every post in its URL. I want the same functionality.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • Possibly [URL rewriting with PHP](//stackoverflow.com/q/16388959) + [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](//stackoverflow.com/q/20563772) – mario Jul 31 '18 at 00:41
  • Your title and your question are not in agreement - they are asking for very different things. – halfer Jul 31 '18 at 07:29
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Jul 31 '18 at 07:29

2 Answers2

2

I think what you are looking for is pretty URLs/friendly URLs.

Here you can read more about it: How to create friendly URL in php?.

And also I found a tutorial about it here.

halfer
  • 19,824
  • 17
  • 99
  • 186
0

What you are looking for is .htaccess's RewriteRule What you want to add is:

RewriteEngine On
RewriteRule ^blog/(.*)$ blog.php?blog=$1

When adding this, /blog/5 will display the content of blog.php?blog=5

Also, check this video out: https://www.youtube.com/watch?v=1pbAV6AU99I