Jump to content

RewriteRule with ID -> Name


Mortier

Recommended Posts

Hello people!

I'm trying to make an .htaccess RewriteRule with an id-name association.

For instance you have an URL like this:
[code]
http://www.example.com/{news_article}.html
[/code]
and you want it to point to:
[code]
http://www.example.com/index.php?news={article_id}
[/code]

Any idea how I should realize this because {news_article} != {article_id}.
The {news_article} can be looked up in an MySQL table using PHP but how should I integrate that here? Or is there another way?

Thanks in advance,

Mortier

Link to comment
Share on other sites

If your script uses an id to identify an article, you will need to change your script to identify the article with the article name instead. mod rewrite cant convert a name to a number. mod_rewrite is only used to create a user friendly url which masks the true URL.
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.