Friendly URL help
I have the link below which I created to test the functionality of the script I wrote. But because the rest of my site is setup with friendly or extensionless URLs, I want to do the same with this one:
This is the current rewrite rule I have in my .htaccess which works fine for normal links:
echo "<a href='meta-paginated.php?page=$i'>$i</a> ";
So the question is,because I cant work it out.
RewriteRule ^(([^/]+/)*[^/.]+)$ index.php?page=$1 [L]
1. What would the regex be for this scenario?
2. How would I need to change the link to work with the new rewrite rule and still select ?page 1,2,3,4,5, etc etc. The page ID is always a number?
Many thanks in advance. If you are kind enough to provide the solution would you be able to explain how you get there so I can learn and pass on my knowledge to other forum users in the future?
Just to add:
This is the link in a raw format:
This is what the URL looks like:
This is the rule I think it should be but not completely sure:
RewriteRule ^meta-paginated/(.*)/(.*)/$ /meta-paginated.php?$1=$2
I am also not sure of the LINK construct that is why I havent listed it here.
Last edited by chrisguk; 04-25-2012 at 02:59 AM.
Not sure if it works.. Simple google on terms 'htaccess friendly url'
You need to put the following lines into your .htaccess file:
RewriteRule /page/(.*)$ /page/page.php?id=$1
This basically tells your website that any request for your page should be re-written. Doing this will mean that your addresses will become further simplified to the following:
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)