TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   php submit form and mod_rewrite (http://www.talkphp.com/general/5348-php-submit-form-mod_rewrite.html)

CΛSTΞX 03-13-2010 06:40 AM

php submit form and mod_rewrite
 
Hello friends, I have a question,

I use mod_rewrite in htaccess,

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?do=search&subaction=search&story=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?do=search&subaction=search&story=$1


It means, normally the search page url is like

site.com/index.php?do=search&subaction=search&story=blabla

but I use mod_rewrite in htaccess and the above url can be seen by visiting this url:

site.com/blabla/

Everything is ok here. But if user search something from search form, the url is seen as

site.com/index.php?do=search&subaction=search&story=blabla

How can I make it the other type of url when user search something from search form? Thank you.

delayedinsanity 03-13-2010 04:48 PM

The simple answer is to use header() - post the form to itself and include a handler that will use the search term in a redirect, ie header( 'Location: http://site.com/blabla/' );

Are you sure you want to set up your mod_rewrite to work this way? Unless you're creating a search engine, I suppose...

iisbum 03-14-2010 01:36 PM

If you have your rewrite rules working, the other option would be to use Javascript in the form, so that when it is submitted, it redirects the user the /<fieldvalue> url instead of doing the regular submit.


All times are GMT. The time now is 09:59 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0