 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
hiteshb Smarty Rookie
Joined: 10 Jul 2010 Posts: 5
|
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: 345 Location: Kathmandu, Nepal
|
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? _________________ Project Manager and Senior Programmer (Bimal Poudel)
Smarty Framework - use it now
Sanjaal Corps, Organized freelancing provider
Hire me in oDesk immediately | Professional support | Personal URL |
|
| Back to top |
|
hiteshb Smarty Rookie
Joined: 10 Jul 2010 Posts: 5
|
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
|