Jump to content

Tricky Problem


onlyican

Recommended Posts

I have a website where all links are running via Mod Rewrites.

For Example
The Address Bar will show
Stories/Read/8/
ANd the real link is
story/read.php?id=8

Nothing too complex.

BUT
I also have links on the left, which makes the font bigger and smaller
I was going to do this by adding ?font=bigger
BUT
Using the Mod ReWrites, this does not work, and I also want to keep the link CLEAN

The only way I can think of doing this, is for every page, to manually type a link for that page

For Example
<a href='/Stories/Read/8/Bigger_text/
Then having the mod rewrite saying something like

ReWriteRule ^Stories/Read/([0-9]*)/Bigger_text story/read.php?id=$1&font=bigger
ReWriteRule ^Stories/Read/([0-9]*)/ story/read.php?id=$1

But is there an easier way?
Link to comment
Share on other sites

If you don't mind having the '?font=bigger' query string on the end of the URL, you can use the QSA (Query String Append) option in mod_rewrite. 

So, your link would be:
  <a href='/Stories/Read/8/?font=bigger'>Bigger Font</a>
    or
  <a href='?font=bigger'>Bigger Font</a>

You rewrite rule would be:
  ReWriteRule ^Stories/Read/([0-9]*)/ story/read.php?id=$1 [QSA]

and the URL would look like:
  http://www.yoursite.com/Stories/Read/8/?font=bigger

Don't know if that's easier or not.
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.