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

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.

Although that does look interesting and a good route to go down, i am currently under pressure to get this working so i don't currently have the time to learn a new technique.

 

If you could help me out with the rule in question i would appreciate it.

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

 

 

 

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.