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
https://forums.phpfreaks.com/topic/32879-rewriterule-with-id-name/
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.

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.