Fetch value from URL?

How can I fetch the value that comes after tags/value.html

The URL: example.com/tags/value.html since the value is always different how can I take it and convert into PHP value I can use in SQL query to search for similar posts!

I can’t use $_GET because I want the URL to be SEO friendly can’t use tags.php?tag=value

You can use tags.php?tag=seo (i.e. $_GET) but then use a URL rewrite in your htaccess to make it sexier :slight_smile: . You can make it look like whatever. Perhaps site.com/tags/value/

Buddy but I want to have this URL in the source code: example.com/tags/value.html not: tags.php?tag=value

Please help me!

Ok, well that’s also possible. Head over to the server forum and they will help you with a rewrite.

I just gave mine as an example…Actually I’ll move this thread for you. Now please wait for someone to come help you.

Please do I am only starting to play with PHP!

lf,

That’s a simple redirection using mod_rewrite (see http://datakoncepts.nz/seo) which will look like this (in your example.com’s .htaccess file):

RewriteEngine on RewriteRule ^tags/([a-z]*)\.html$ tags.php?tag=$1 [L]

If you have questions on this code (or where to use it), please READ the link above as it will tell you everything you need to know about mod_rewrite. THEN, if you still have questions, come back here or PM me directly.

Regards,

DK

Thanks buddy very much I will PM you thanks bug time!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.