0

I want to rewrite example.com/index.php?post_id=1&seri_id=5 to example.com/seri-name/post-name

I found this:

Store the following in your web roots .htaccess file:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

In the example above, all URLs are sent on to the index.php scripts. Fetch the URL inside the index.php like this:

$route = $_SERVER['PHP_SELF'];
$route = substr($route, strlen('/index.php'));

but I didn't understand how I can the rewrite process. Can somebody help? Is it the best way to do what I wanted? Is There anything that I can edit to improve it?

S. Ali Mirferdos
  • 192
  • 1
  • 2
  • 12

0 Answers0