Reputation: 35
I have this following url localhost/test/index.php?page=1
And i want it to be
'index.php/page/1'
so far I have this :
RewriteEngine On
RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [NC,L]
But it's not working .Any suggestion what am i doing wrong ?
Upvotes: 0
Views: 129
Reputation: 3546
Try with this
RewriteRule ^page/([^/]*)$ index.php/?page=$1 [L]
If you set it correct then URL like this http://localhost/test/page/1
should work
Upvotes: 1
Reputation: 1142
RewriteRule ^index.php\/page\/(.*?)\/?$ index.php?page=$1 [NC]
The above code should solve your probleem. But you may want to read up on mod_url_rewrite
See https://www.sitepoint.com/guide-url-rewriting for more info
Upvotes: 0
Reputation: 1
Try this one
RewriteEngine on
RewriteRule ^(.*)/page/([0-9]+)$ /index.php?page=$2 [NC,L]
The url will be
localhost/test/index.php/page/123
If you want the url looks like
localhost/test/index.php/page/123/
change you rule into this one
RewriteEngine on
RewriteRule ^(.*)/page/([0-9]+)/$ /index.php?page=$2 [NC,L]
Upvotes: 0