Jump to content

Is there a way to fake a .htm extension at the end of every URL on my site?


yeehawjared

Recommended Posts

I'm building a site similar to www.ultimate-guitar.com.  Let's digest a sample URL from their site:

http://www.ultimate-guitar.com/tabs/[color=green]l[/color]/[color=blue]led_zeppelin[/color]/[color=red]stairway_to_heaven[/color][color=orange]_ver4_[/color][color=teal]tab[/color][b].htm[/b]

I can assume the variables getting passed are something like:
[color=green]?artistLetter=l[/color]
[color=blue]?artist=led_zeppelin[/color]
[color=red]?title=stairway_to_heaven[/color]
[color=orange]?version=_ver4[/color]
[color=teal]?type=_tab[/color]
[b].htm[/b]

I can emulate this via mod_rewrite up to the point where they have "[color=red]stairway_to_heaven[/color][color=orange]_ver4_[/color][color=teal]tab[/color][b].htm[/b]"  I don't understand how they are keeping these variables separate without something like a / (forward slash) between them.  I also don't know how they tack on a .htm on the end of every URL

here is my .htaccess file  (note:  I don't care about separating out the artistLetter as ultimate-guitar has done.  root.php figures out what do do with the variables)

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ root.php?artist=$1 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ root.php?artist=$1&title=$2 [L]
</IfModule>

does anyone know how to generate this fake URL and retrieve the variables inside it ([color=red]title[/color], [color=orange]version[/color], and [color=teal]type[/color]) while adding a .htm at the end?

Many thanks guys :)
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.