Jump to content

Building links using php and htaccess?


gibbonuk

Recommended Posts

Hi, im a little confused on which way im meant to be doing this.

 

I have a URL that my php builds with parameters depending on user selections. So we may end up with:

 

www.mysite.co.uk/mypage.php?p1=10&p2=20&p3=40

 

And i have a simple mod rewrite to show that more SEO friendly. So  a user could goto

 

www.mysite.co.uk/mypage-p1-10-p2-20-p3-40.html

 

and it would work, BUT when the user goes to the above .html address it works but shows in the address bar as:

 

www.mysite.co.uk/mypage.php?p1=10&p2=20&p3=40

 

I also thought it would be good to build my links withing PHP as the SEO friendly ones but again, when the link is clicked the user sees the old one?

 

So.. which way am i meant to be doing this?

 

What i would like is to completly hide the actualy URL and have it so if the user goes via the SEO friendly one it works and SHOWS the SEO freindly one, this way i can use them links in my pages aswell.

 

Thanks

Andy

Link to comment
Share on other sites

You need to make your code produce the more SEO friendly one, then mod-rewrite maps it through to the original.

 

If you making the SEO type links and they are being redirected to the older style, there is something wrong with your rewrite rule.

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.