Friendly URL with Generic Parameters .htaccess [duplicate]

2

I would like to set up a URL friendly with generic parameters, that is, receive any parameter in any quantity or file.

Today I set the .htaccess so that the filename becomes URL . File I'm using:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*?)$ $1.php
    Options -Indexes

    ErrorDocument 404 /erro.php
</IfModule>

Example of URL you'd like:

  

If anyone knows how to ride, it would be a lot of help.

    
asked by anonymous 18.01.2016 / 12:01

1 answer

0

You can do it this way, so you create the post file and leave it as if it were an example category: www.site.com.br/post/primary-materia/1 In this example you need to pass the post ID to list the site with the GET method.

RewriteEngine On
RewriteBase /
#1
RewriteRule ^post\/([^\/]|.+[^\/]+)\/(\d+)\/?$ /posts.php?nome=$1&sid=$2
[QSA,L]
#0
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1
    
18.01.2016 / 13:47