Jump to content

MOD Rewrite - Cannot work out the correct rule


adamjblakey

Recommended Posts

Hi,

 

What i have done is set-up links like this:

<a href="{$domain}/corporate-events/{$result.subcategory|stripres}.html" title="Corporate Events - {$result.subcategory}" class="submenu">{$result.subcategory}</a>

 

With the re-write rule:

RewriteRule ^corporate-events/(.*)\.html$ entertainment-listings.php?title=$1

 

This is working fine but what i want to do now is have the link like this:

<a href="{$domain}/{$resultb.region|stripres}/{$cat}/{$pagename|stripres}.html" title="{$resultb.area} - {$resultb.region}" class="submenu">{$resultb.region}</a>

 

What would the re-write be on this?

 

Cheers,

Adam

Link to comment
Share on other sites

Have you thought about rewriting every request that's not to an existing asset to a single PHP file, then have that file determine which PHP scripts to include?  That way you have a single place where every page request starts from, where you can put your authentication/database/libraries/etc., at a very low overhead.

Link to comment
Share on other sites

well adam - the difficulty is that all of your url is dynamically generated!!!

 

The only surefire thing in there is that you will have 3 forward slashes - and I bet your bottom dollar that other sections of the site have the same and you don't want them re-directing to the same script.

 

what would be more beneficial is to name the php scripts after the sections you want to redirect to then you could have a general rule for re-direction like so

 

RewriteRule ^([^/]*)/(.*)\.html$ $1.php?title=$2

 

and so on...

 

 

 

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.