.htaccess tutorial

htaccess Elite


question with browser url and passing that input to php

Using PHP in and with htaccess

question with browser url and passing that input to php

New postby calimerokonj » 28 Oct 2009 01:37

Hey, my first post here so... here it goes

On my machine i installed Zend Community Server... with apache 2.2.x
My previous knowledge of .htaccess is ... very scarce
Server is Win2008

Problem that i keep getting hit with (after 6 days of browsing forums and examples and snipets etc...) is the following - pass string to a php variable if there is no php webpage specified:

When visitor enters this for ex into the browser adress bar:
http://www.mysite.info/some_random_phrase_with_no_blanks - basicaly represented with (.*) in htaccess regex pattern
i need apache to convert it to this
http://www.mysite.info/solution.php?var1=some_random_phrase_with_no_blanks
so my php/mysql can continue the job.

but important note - main condition is:
if the "word" solution.php is NOT found - DO rewrite/redirect as mentioned above
if the "word" solution.php is found in the haystack - DONT redirect or rewrite just leave it as it is

99% of time while experimenting i am getting 404 when i input random stuff after my website url (or localhost as i test it there), 1% i get Forbidden - as i have prevented directory listings

Dunno if it makes any big difference that my webserver with Zend (legacy) atm ignores any .htaccess files in directories and only editing i can do by putting the usual:
RewriteEngine On
RewriteBase /
RewriteRule ........
inside httpd.conf.
It works but i am simply out of ideas on how construct the pattern that matches properly - which i think is atm the only reason it doesnt work



I do realise that this may seem like very easy for someone with enuf expirience in htaccessing but i would rly appreciate worrking regex line to copy/paste.

Thanks in advance.
calimerokonj
 
Posts: 1
Joined: 28 Oct 2009 01:17

Return to PHP and htaccess