Apache Server configuration support - URL rewrite help - redirect complete URI

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > July 2006 > URL rewrite help - redirect complete URI





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author URL rewrite help - redirect complete URI
arun.iit@gmail.com

2006-07-12, 7:30 am

I want to dynamicaly generate pages for my domain name

for example,

I want to internally redirect
mydomain.com/company/new to mydomain.com/parse.php?value=/company/new
mydomain.com/anything to mydomain.com/parse.php?value=/anything

I want to redirect the complete URI and not any pattern.

Plz tell me hw do i form the redirect rule to implement this.

Thanks in advance.

frizzle

2006-07-12, 7:30 am


arun.iit@gmail.com wrote:
> I want to dynamicaly generate pages for my domain name
>
> for example,
>
> I want to internally redirect
> mydomain.com/company/new to mydomain.com/parse.php?value=/company/new
> mydomain.com/anything to mydomain.com/parse.php?value=/anything
>
> I want to redirect the complete URI and not any pattern.
>
> Plz tell me hw do i form the redirect rule to implement this.
>
> Thanks in advance.


RewriteRule ^(parse\.php)$ - [L]
RewriteRule ^(.*)$ parse.php?value=$1 [L]

Wich would still allow you to request parse.php directly, wich still is
sort of a problem of mine as well ...

AFAIK it would be better to use index.php instead of parse.php, unless
parse.php is defined as default index page ... (i believe otherwise
you'd get an infinite loop)

Frizzle.

Arun

2006-07-12, 7:30 am

Hi frizzle

Thanks for the quick help.

I tried out that, but the $1 didnt have any content in it.
But then the redirection to parse.php worked.
So i just used the $_SERVER['REQUEST_URI'] variable to get the url of
the page requested. This has solved my problem.

Thanks again

Arun

frizzle wrote:
> arun.iit@gmail.com wrote:
>
> RewriteRule ^(parse\.php)$ - [L]
> RewriteRule ^(.*)$ parse.php?value=$1 [L]
>
> Wich would still allow you to request parse.php directly, wich still is
> sort of a problem of mine as well ...
>
> AFAIK it would be better to use index.php instead of parse.php, unless
> parse.php is defined as default index page ... (i believe otherwise
> you'd get an infinite loop)
>
> Frizzle.


frizzle

2006-07-12, 7:30 am


Arun wrote:[vbcol=seagreen]
> Hi frizzle
>
> Thanks for the quick help.
>
> I tried out that, but the $1 didnt have any content in it.
> But then the redirection to parse.php worked.
> So i just used the $_SERVER['REQUEST_URI'] variable to get the url of
> the page requested. This has solved my problem.
>
> Thanks again
>
> Arun
>
> frizzle wrote:

Not the $1 is a ONE, not a small L,
You could also use parse.php?value=%{REQUEST_URI}

Frizzle.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com