Jump to content

Rewrite URL to hide ?get= in .htaccess


slj90

Recommended Posts

Hello,

Here is the structure of my website:

website.com/events/page1?date=1224
website.com/events/page2?date=0101
website.com/events/page3?date=1105

There are lots of different pages all of which I would like to use the $_Get 'date' on.

I want to rewrite the URL using htaccess so that they can be loaded like this:

website.com/events/page1/1224

website.com/events/page2/0101

website.comevents/page3/1105

 

Is this possible without having to create a separate rule for each page?

Thanks in advance!

Edited by slj90
Link to comment
Share on other sites

Do you already have rewriting rules for /events/page1 and so on? Because those don't look like regular files. I sure hope they aren't. If so then you should modify those to use (or at least support) your desired /events/pageN/MMDD scheme.

 

[edit] Whatever the answer, the first part of the RewriteRule will look something like

RewriteRule ^/?events/page(\d+)/(\d\d\d\d)$
which would allow for dates like 9876, but it's really not worth trying to handle that here (and not just because of the complexity). Edited by requinix
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.