Mod rewrite, headers and htaccess

I was involved in providing some SEO recommendations on a website that has been operating since 2005. My problem is that I want to use clean urls.

The code that processes the URL is hidden in some class file. And with more than a few thousand lines of code, it's his struggle to rewrite.

Therefore, I think that I went through all the products and created a bullet for them as a field in the product table. Is it possible to do something like an intermediate file for .htaccess?

Sort of

  • / cleaning slug comes in /
  • .htaccess catches this and uses slug.php to find the appropriate product identifier for the bullet.
  • Then the product.php file is loaded? id = (ID.found.from.2).
+3
source share
4 answers

slug.php:

$id="ID.found.from.2";
include 'product.php';
+2
source

You can associate rewrite rules, but AFAIK cannot execute two scripts in one request and use the output from 1 as a parameter in the second.

0
source

PHP script (. RewriteMap ). .

, slug slug.php script, , $_GET['id'] , product.PHP .

0

:

Eeverything , slug.php ,

, - , .

0

Source: https://habr.com/ru/post/1742275/


All Articles