Re: [users@httpd] Help Gor básico ( :-) ) rewrite

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

 



You do not need a RewriteCond here, the RewriteRule directive is perfectly capable of capturing the request uri path.

If you don't want the URL to change, then perhaps you should use AliasMatch instead of mod_rewrite. If you want to change the URL, use RedirectMatch instead.

Using mod_rewrite should be the last resort, and if chosen, using the rewrite log to debug would help.

On Sun, 3 Apr 2022 at 16:27, Jim Albert <jim@xxxxxxxxxxxxx> wrote:
On 4/3/2022 12:34 PM, Aitor Iturriondobeitia wrote:
Hello, I'm new to this topic and I'm finding it difficult. Let's see if you can help me please.
I am trying to remove the contextroot from my application.
For example, I have the following URL that calls me:
and I want to eliminate, in the rewrite, the REDF00K leaving www.domain.com/form.xhtml
in such a way that if they call me to www.domain.com/REDF00K/form.xhtml it would resolve internally to www.domain.com/form.xhtml
for this I am using

RewriteEngine On
LogLevel debug rewrite:trace3
RewriteRule ^/REDF00K/$ /$1 [R=301,NC,L]

but it's not working for me
Can you help me?

Thank you very much

I think the main issue is you aren't capturing the portion of the original URL path that you want to use in the RewriteRule

Try this
RewriteEngine On
RewriteRule ^/REDF00K/(.*)$ /$1 [R=301,NC,L]

I notice in the few places I've used mod_rewrite I have a RewriteCond, but I'm not positive if it is necessary. I don't think it is unless there's a condition you want to meet outside of the URL path. However, If the above doesn't work try:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/REDFOOK/
RewriteRule ^/REDF00K/(.*)$ /$1 [R=301,NC,L]

(note... I didn't test any of this).


-- 
Jim Albert

[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