TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-13-2010, 06:40 AM   #1 (permalink)
The Acquainted
 
Join Date: Feb 2008
Posts: 107
Thanks: 3
CΛSTΞX is on a distinguished road
Arrow 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.
__________________
Downloadic
infolizer
Send a message via MSN to CΛSTΞX
CΛSTΞX is offline  
Reply With Quote
Old 03-13-2010, 04:48 PM   #2 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

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...
delayedinsanity is offline  
Reply With Quote
Old 03-14-2010, 01:36 PM   #3 (permalink)
The Wanderer
 
Join Date: Nov 2007
Posts: 20
Thanks: 1
iisbum is on a distinguished road
Default

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.

Last edited by iisbum : 03-14-2010 at 01:36 PM. Reason: typo
iisbum is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:26 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design