|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
hiteshb Smarty Rookie
Joined: 10 Jul 2010 Posts: 11
|
Posted: Sat Jul 10, 2010 5:07 am Post subject: HTTP Header Redirect |
|
|
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 |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Sat Jul 10, 2010 9:53 pm Post subject: add a different line |
|
|
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 |
|
hiteshb Smarty Rookie
Joined: 10 Jul 2010 Posts: 11
|
Posted: Sun Jul 11, 2010 5:53 am Post subject: |
|
|
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 |
|
|
|
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
|