Welcome to MobyThreads.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Apache's mod_rewrite Help

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Related Topics:
Apache Log IP Via - Hi to all, i have an apache external and more apache internal. On external Apache I set more and with mod_proxy talk with all internal apache. For example: On ProxyPass / /..

Apache og ASP ? - Hello Can anyone here explain to me, if it is in Apache .conf file or somewhere in Sun One ASP I should configure the so my users cannot see anything but there own directory on the Apache server ? The situation is as

apache 2 and php on mac - what lines do i need in the httpd and what files or other do i need to get it in. macosx 10.3.5 and have switched to a fink so that may involve some heavy dancing. jimt

ASP.Net under Apache - Is there a module for Apache that allows the running of ASP.Net? Perhaps uses Mono?

apache not doing any PHP. - Hi I'm running Apache 1.3 with mod_php4 on a suse 9.0 box. However when a client tries to open a the file download dialog opens instead of showing the contents of the page. The PHP Module seems to be loaded my has the..
Next:  Apache: Apache's mod_rewrite  
Author Message
Php Developer

External


Since: Oct 02, 2007
Posts: 3



(Msg. 1) Posted: Tue Oct 02, 2007 8:20 am
Post subject: Apache's mod_rewrite Help
Archived from groups: alt>apache>configuration (more info?)

Anybody can explain Apache's mod_rewrite technique so that i can use
this technique.
For example link is this
www.example.com/foo123
i want to have foo123 as code to work for further use in php...

 >> Stay informed about: Apache's mod_rewrite Help 
Back to top
Login to vote
Php Developer

External


Since: Oct 02, 2007
Posts: 3



(Msg. 2) Posted: Tue Oct 02, 2007 11:50 am
Post subject: Re: Apache's mod_rewrite Help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> > Anybody can explain Apache's mod_rewrite technique so that i can use
> > this technique.
>
> The documentation of apache is fairly complete.www.apache.org
>
> Davide


Hi,Thanks for your reply.Yeah i know that apache documents are
complete but basicly i m new to this type of coding and i want to use
this concept in Php.If you know can you help me out with code.I m very
thankfull for ur help.
My problem is that :
For example link is this
www.example.com/foo123
i want to have "foo123" in my php file for further processing.Thanks

 >> Stay informed about: Apache's mod_rewrite Help 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2907



(Msg. 3) Posted: Tue Oct 02, 2007 12:58 pm
Post subject: Re: Apache's mod_rewrite Help [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
sean dreilinger

External


Since: Jun 26, 2007
Posts: 4



(Msg. 4) Posted: Thu Oct 11, 2007 2:53 am
Post subject: Re: Apache's mod_rewrite Help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

hi, from the information you've offered, it sounds more like a php question than
an apache question. the server variables populated by apache are available to
php programs in an array called $_SERVER[]; this page in the php manual
documents them:

http://us2.php.net/manual/en/reserved.variables.php#reserved.variables.server

when a user requests the URI /foo123 from your web server, your php script that
handles these requests would look for a URI that matches /foo123, and issue some
instructions:

if ( preg_match( "#^/foo123#", $_SERVER["REQUEST_URI"] ) ) {
send123(); # function you've written to handle this case
exit(0);
} elseif ( preg_match( "#^/foo456#", $_SERVER["REQUEST_URI"]) ) {
send456(); # function you've written to handle this case
exit(0);
}

i suspect you'll get way better advice from a php-oriented discussion group.

good luck!
-sean

--
sean dreilinger - http://durak.org/sean/


Php Developer wrote:
> Hi,Thanks for your reply.Yeah i know that apache documents are
> complete but basicly i m new to this type of coding and i want to use
> this concept in Php.If you know can you help me out with code.I m very
> thankfull for ur help.
> My problem is that :
> For example link is this
> www.example.com/foo123
> i want to have "foo123" in my php file for further processing.Thanks
 >> Stay informed about: Apache's mod_rewrite Help 
Back to top
Login to vote
klenwell

External


Since: Oct 12, 2007
Posts: 1



(Msg. 5) Posted: Fri Oct 12, 2007 6:05 pm
Post subject: Re: Apache's mod_rewrite Help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Oct 11, 2:53 am, sean dreilinger <sean-use....TakeThisOut@durak.org> wrote:
> hi, from the information you've offered, it sounds more like a php question than
> an apache question. the server variables populated by apache are available to
> php programs in an array called $_SERVER[]; this page in the php manual
> documents them:
>
> http://us2.php.net/manual/en/reserved.variables.php#reserved.variable...
>
> when a user requests the URI /foo123 from your web server, your php script that
> handles these requests would look for a URI that matches /foo123, and issue some
> instructions:
>
> if ( preg_match( "#^/foo123#", $_SERVER["REQUEST_URI"] ) ) {
> send123(); # function you've written to handle this case
> exit(0);} elseif ( preg_match( "#^/foo456#", $_SERVER["REQUEST_URI"]) ) {
>
> send456(); # function you've written to handle this case
> exit(0);
>
> }
>
> i suspect you'll get way better advice from a php-oriented discussion group.
>
> good luck!
> -sean
>
> --
> sean dreilinger -http://durak.org/sean/
>
> Php Developer wrote:
> > Hi,Thanks for your reply.Yeah i know that apache documents are
> > complete but basicly i m new to this type of coding and i want to use
> > this concept in Php.If you know can you help me out with code.I m very
> > thankfull for ur help.
> > My problem is that :
> > For example link is this
> >www.example.com/foo123
> > i want to have "foo123" in my php file for further processing.Thanks

This is the basic concept. But usually the request uri is rewritten
so as to direct to a controller or dispatch script with a query
string.

So, for example, I'll often use a uri like this:

www.example.com/view/foo123/

And then set my rewrite rule in .htaccess to something like this:

^view/(.*) -> index.php?view=$1

Then in index.php, you have a case tree like Sean presented above:

if ( $_GET['view'] == 'foo123' )
{
send_to_script($_GET['view']);
}

That's a rough outline of what you're probably trying to do. Google
some combination of php, mod_rewrite, apache, and "clean urls", and
you can find more detailed guides.
 >> Stay informed about: Apache's mod_rewrite Help 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can 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



[ Contact us | Terms of Service/Privacy Policy ]