Jump to content

2 really simple mod rewrite questions


AdRock

Recommended Posts

I have this rewrite rule which reads [url=http://www.jackgodfrey.org.uk/news/1/2]www.jackgodfrey.org.uk/news/1/2[/url]

[b]RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/([0-9]+)/?$ index.php?page=$1&limit=$2&pagenum=$3 [L][/b]

How would I rewrite that to read [url=http://www.jackgodfrey.org.uk/news/2]www.jackgodfrey.org.uk/news/2[/url] so it takes the /1/ out as that never changes.  It's only a limit to how many records are listed per page

The second question is this:

I have 4 pages names jack1, jack2, jack3 and jack4

How would i create a rule to read like this [url=http://www.jackgodfrey.org.uk/jack/1]www.jackgodfrey.org.uk/jack/1[/url] etc?
Link to comment
Share on other sites

Do you wantr to get rid of the limit parameter completly if so use this:
[code]RewriteRule ^([A-Za-z0-9]+)/([0-9]+)/?$ index.php?page=$1&pagenum=$2 [L][/code]

For your secound question, I'm not sure but prehaps this:
[code]RewriteRule ^jack/([0-9]+)/$ jack$1.php[/code]
by file name you mean jackx.php, x being a number?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.