Reputation: 177
I am new on that htaccess thing.
My problem is, I have a pagination on index.php:
http://localhost/index.php?pagina=2
I want to access this with this url:
http://localhost/page/2
I try on htaccess:
RewriteEngine On
RewriteRule /page/(.*)$ index.php?pagina=$1
but it gave me a 404 error.
Upvotes: 1
Views: 578
Reputation: 45829
In per-directory .htaccess files the directory prefix, of where this .htaccess file is located, is removed from the URL-path when pattern matching. In the document root, this is simply /
(a slash). So your RewriteRule
would need to be rewritten as:
RewriteRule ^page/(.*) /index.php?pagina=$1 [L]
Upvotes: 1
Reputation: 18671
Use:
RewriteEngine On
RewriteRule page/(.*)$ index.php?pagina=$1
without first /
Upvotes: 0