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
https://forums.phpfreaks.com/topic/32052-tricky-problem/
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
https://forums.phpfreaks.com/topic/32052-tricky-problem/#findComment-148833
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.