Jump to content

Rewrite not redirect


emma57573

Recommended Posts

The following code works by redirecting, example:

 

www.mydomain.co.uk/gifts/art.html

 

goes to

 

http://www.mydomain.co.uk/handmade-gifts.php?cid=Art

 

Thats all great and works HOWEVER It redirects (which yes is what I wanted) BUT the address bar changes to the long address but what I really want to do is keep the clean address in the address bar to fool SE into thinking they are looking at www.mydomain.co.uk/gifts/art.html as a static page.

 

I know this must be possible as Ive seen lots of sites doing the same thing what am I doing wrong? I should add im new to .htaccess and learning as I go!

 

 

Options +FollowSymlinks

RewriteCond %{HTTP_HOST} ^www.mydomain.co.uk
RewriteRule ^gifts\/(.*)\.html http://www.mydomain.co.uk/handmade-gifts.php?cid=$1 [NC]

Link to comment
https://forums.phpfreaks.com/topic/152643-rewrite-not-redirect/
Share on other sites

I still havnt had a chance to dig deep into this, anyone have an suggestions?? I thought when I did the mod rewrite it would change the domain and so the domain would stay in the address bar but it seems all it does is send a redirect.

 

I want to use this rule for all my dynamic pages, but I dont want this type of redirection as I dont want to get penalized by google for having redirects everywhere!

 

Maybe Im barking up the wrong tree with .htaccess altogether and theres another way round it altogether.

 

As I said its going to the right page and the link its right every things good apart from the fact the the redirection shows the dynamic page in the menu bar. I just dont want it to look like a redirection (even though it kind of is?? )  :-\

Link to comment
https://forums.phpfreaks.com/topic/152643-rewrite-not-redirect/#findComment-804676
Share on other sites

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.