Forum Moderators: coopster

Message Too Old, No Replies

php rewrite

         

bheybugarin

2:11 am on Jan 9, 2004 (gmt 0)

10+ Year Member



I want to know if anybody in the forum can help me to rewrite a php search results to a static pages using .htacces command

From:
web.php?search=keyword
index.php?search=keyword

To:
websearch-keyword.php
search-keyword.php

Im using Linux - CPANEL control panel.

bheybugarin

5:19 am on Jan 9, 2004 (gmt 0)

10+ Year Member




Im trying this in .htaccess but not working:

rewriteEngine on
rewriteBase /
rewriteRule (.*)/(.*)/(.*)/(.*)\.htm$ /index.php?search=<?=$search;?> [T=application/x-httpd-php,L]

jdMorgan

6:05 am on Jan 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



bheybugarin,

This subject comes up quite often.

mod_rewrite is activated after an HTTP request is received by the server, but before any content is served. What this means is that if you want static-looking URLs to feed to search engine spiders and users, then your script has to output those static URLs -- mod_rewrite can't change them as content is being served.

However, when an HTTP request is later received for one of those static URLs, mod_rewrite *can* be used to change it back into a script call with parameters passed in the query string.

I hope that's helpful. Try doing a site search on WebmasterWorld for terms related to query string, rewriterule, etc. You'll turn up a ton of good information.

Jim

bheybugarin

7:52 am on Jan 9, 2004 (gmt 0)

10+ Year Member



Im new to this:

My site is set up like this:
www.domain.com/web.php?search=keyword
www.domain.com/index.php?search=keyword

and want to convert it to:
www.domain.com/websearch-keyword.php
www.domain.com/search-keyword.php

keyword is: <?=$search;?>

Anyone can help me about this?

Sorry if this is already discuss, I cannot find the same topic that I understand.