apache rewrite
Shahzad Chohan
shahzad.chohan at gmail.com
Mon May 23 09:11:00 UTC 2005
Hi Chris
Many Thanks for that.
Whats the difference between a rewrite and a redirect. I mean is there
a reason as to why I need a 301 ( I was just told to issue a 301 by
someone else). If I don't put an R in on the rewrite whats the default
return? Can I also issue an R=404?
Please excuse my ignorance
Thanks
Shaz
On 5/20/05, Chris Grau <chris at chrisgrau.com> wrote:
> On Fri, May 20, 2005 at 05:13:14PM +0100, Shahzad Chohan wrote:
> > Hi Guys,
> >
> > Wonder if you can help me.
> >
> > I have a url where I want to redirect everything and return a 301. But
> > I want the base url and /index.html
> >
> > to not redirect.
> >
> > Can someone please explain how I can do this?
>
> That should be pretty easy with mod_rewrite. Just off the top of my
> head:
>
> RewriteEngine On
> RewriteCond %{REQUEST_URI} !^/$
> RewriteCond %{REQUEST_URI} !^/index.html$
> RewriteRule ^/(.*) http://www.example.com/$1 [R=301,L]
>
> The two RewriteCond directives tell mod_rewrite not to execute the rule
> for those conditions (the matches are negated by the !). Everything
> else is redirected with status 301 by the RewriteRule.
>
> For more info on how this works, the mod_rewrite document is pretty
> informative:
>
> http://httpd.apache.org/docs/mod/mod_rewrite.html
> http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html
>
> > Thanks
> > Shaz
>
> -chris
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
>
More information about the fedora-list
mailing list