1

I have seen various sites now defining the products name in the URL ... for example

http://www.webesite.co.uk/hp/hp-c9701a-cyan-toner-cartridge-original

instead of

http://www.webesite.co.uk/product.php?product=hp-c9701a-cyan-toner-cartridge-original

I am aware and have used a lot the $_GET function to get parameters specified in the URL after the .php file tag, but my question is how do you provide a parameter to replace the file name rather than specifying it at the end of the file name?

I'm working in PHP but I'm not sure if this is achieved using the .htaccess file

I am also interested to know which will perform best SEO wise???

3
  • 1
    This post might be of some assistance... Commented May 9, 2013 at 18:02
  • that is done with the .htaccess mode_rewrite. The Apache Official documentation about this topic can be found here Commented May 9, 2013 at 18:04
  • Here is my solution in similar post Commented May 9, 2013 at 18:17

2 Answers 2

2

Yes you need to use the mod_rewrite with .htaccess to redirect to the correct resource.

Here is some usefull link that explaim better what you actually need to do in .htaccess:

http://zenverse.net/seo-friendly-urls-with-htaccess/

And here is a similar thread in Stackoverflow:

How to create friendly URL in php?

Sign up to request clarification or add additional context in comments.

Comments

0

It's usually done by redirecting every request to index.php using .htaccess and than by parsing (explode()) URL you can get every part of it and treat as a parameter.

You can also read about routing and router classes which are designed to do this work for you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.