Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

HTTP Header Redirect

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
hiteshb
Smarty Rookie


Joined: 10 Jul 2010
Posts: 11

PostPosted: Sat Jul 10, 2010 5:07 am    Post subject: HTTP Header Redirect Reply with quote

I want to add HTTP redirect header in my php file (I am using smarty offcourse)

Earlier my url use to be
Code:
viewschedule.php?id=$


I changed the url to
Code:
schedule/([^/]*)-blah-blah-blah.php


For that added below code to htaccess

Code:
RewriteRule ^schedule/([^/]*)-([^/]*)\.php$ /viewschedule.php?id=$1 [L]


Now, I want spiders to know new url (although pages are still same).

Can anyone help me getting correct http code to put in php file.

I think I will need to add variables and all to http header url so that google can know new url and pass all pagerank and other sort of things to new url.

I tried to add R=301 in htaccess file but it was not working.
Back to top
View user's profile Send private message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Sat Jul 10, 2010 9:53 pm    Post subject: add a different line Reply with quote

Your problem is not related to Smarty.
But this may help you:

You need to a add some more lines in your .htacces to point old link to new one. Try:

Code:

RewriteCond %{QUERY_STRING} id=(\d+)
RewriteRule viewschedule.php schedule/%1-blah-blah-blah.php [QSA,L]


If it finds viewschedule.php?id=1, it goes to schedule/1-blah-blah-blah.php

Does this work?
Back to top
View user's profile Send private message Visit poster's website
hiteshb
Smarty Rookie


Joined: 10 Jul 2010
Posts: 11

PostPosted: Sun Jul 11, 2010 5:53 am    Post subject: Reply with quote

It doesn't work.

Neither it does rewrite nor it does redirect.

What I see problem is with that blah-blah section. To improve keywords in url I added those keywords. This keywords are taken from database directly and therefore they are different with each unique id
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP