Re: Help needed for rewrite rule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It doesn't work because is incorrect. It should be:

RewriteRule ^/(.*) http://mywebsite.com/spaces/$1 [R,L]

Notice the $1 expretion that's the key for the redirection

Igor

On Thu, Apr 16, 2009 at 11:24 AM, ravi kumar <ravindra_luv23@xxxxxxxxxxx> wrote:
Hi Brian,

Thanks for your help.
I tried to resolve this issue on my own, but it didn't worked.

For redirecting i used the below rule
"RewriteRule ^/(.*) http://mywebsite.com/spaces/ [R]"

After executing the site i.e "http://mywebsite.com/xxxx"
it throws an exception like "The requested URL /xxxx was not found on this server"


And still it is not working.


Thanks,
Ravi




--- On Thu, 16/4/09, Brian Mearns <mearns.b@xxxxxxxxx> wrote:

From: Brian Mearns <mearns.b@xxxxxxxxx>
Subject: Re: Help needed for rewrite rule
To: users@xxxxxxxxxxxxxxxx
Date: Thursday, 16 April, 2009, 5:40 AM

On Wed, Apr 15, 2009 at 7:51 PM, Brian Mearns <mearns.b@xxxxxxxxx> wrote:
> On Wed, Apr 15, 2009 at 7:41 PM, Igor Cicimov <icicimov@xxxxxxxxx> wrote:
>> RewriteEngine On
>> RewriteRule ^/(.*) /spaces/$1
>>
>> Igor
>
> Actually, since it was specified as needing to redirect, you need the
> [R] flag at the end, but that will end up redirecting forever. You
> need to either set up the rewrite to not match when the requested URL
> starts with /spaces/ (which would probably be a little tricky), or
> just use a RewriteCond to apply when it *doesnt* match ^/spaces/.* .
>
> Even if you don't actually want to redirect, but just do an internal
> rewrite, you should probably still include this precaution (in fact,
> you might need it, I'm not sure) in case someone actually tries to
> access http://website.com/spaces/something.
>
> -Brian


<flame on>

Pardon the follow up: With all due respect, Ravi, this is a trivial
use of mod_rewrite. The fact that you were unable to figure it out and
did not offer any indication that you even made any attempts at
figuring it out suggests that you have done little if any reading on
how to use the directives in question and are merely looking for
someone else to do your work. There's been a lot of this going on
lately on this list and---as has been pointed out by another
poster---those of us participating in this list are essentially
volunteers and have more important/interesting things to do than solve
trivial problems for slackers. In other words, RTFM.

<flame off>

If you did in fact attempt to solve the problem yourself, then I
apologize: you'll get better results and more respect when you post
details on what you've already tried and specifically how its not
working the way you expect it to.

-Brian

--
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://keys.gnupg.net

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



Add more friends to your messenger and enjoy! Invite them now.


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux