-2

I have a custom made php site where content loads depending on the query string. Now I want to change the total url to be like wordpress site where they don't show any query.

Example:

Current page with query: http://example.com/content.php?category=game&c=car-racing

What I want: http://example.com/game/car-racing

Is that possible?

If possible, then how do I write link href within the html code of php page? Will it be like

<a href="http://example.com/content.php?category=game&c=car-racing">Text</a>

or

<a href="http://example.com/game/car-racing">Text</a>
coderpol
  • 303
  • 3
  • 12
  • 2
    Possible duplicate of [URL rewriting with PHP](http://stackoverflow.com/questions/16388959/url-rewriting-with-php) – Jeff Puckett Jul 18 '16 at 04:08
  • funny that developer with 3 years experience don't know how to rewrite urls. there are tons of examples how to do url rewriting. why those PHP devs are so lazy? (: – num8er Jul 18 '16 at 04:16

2 Answers2

0

modify your .htaccess file

RewriteEngine On
RewriteRule ^(.*)/(.*)& content.php?category=$1&c=$2 [QSA,NC]
Ahmad ghoneim
  • 844
  • 7
  • 13
0
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

But still, u would have to handle the links and separate them for each parameter. So rather than doing all that you can use Helium. Try https://github.com/iamyogik/Helium