Mailing List Archive

I need help with a rewrite request
I have just received a request to rewrite everything http://school.northwestern.edu/faculty/name/ to http://school.northwestern.edu/faculty/name.html I believe I can bury this rule in a directory declaration for the faculty directory but I am having problems writing the exact rules to make the transform happen. My stumbling block is I do very few new rewrite rules. Most are simple modifications of existing rules. Please help.

Darryl Baker, GSEC, GCLD (he/him/his)
Sr. System Administrator
Distributed Application Platform Services
Northwestern University
4th Floor
2020 Ridge Avenue
Evanston, IL 60208-0801
darryl.baker@northwestern.edu<mailto:darryl.baker@northwestern.edu>
(847) 467-6674<tel:+18474676674>
Re: I need help with a rewrite request [ In reply to ]
You don't need to use mod_rewrite, a simpler solution is to use multiviews:

https://httpd.apache.org/docs/current/content-negotiation.html#multiviews

On Wed, 28 Sept 2022 at 09:18, Darryl Philip Baker <
darryl.baker@northwestern.edu> wrote:

> I have just received a request to rewrite everything
> http://school.northwestern.edu/faculty/name/ to
> http://school.northwestern.edu/faculty/name.html I believe I can bury
> this rule in a directory declaration for the faculty directory but I am
> having problems writing the exact rules to make the transform happen. My
> stumbling block is I do very few new rewrite rules. Most are simple
> modifications of existing rules. Please help.
>
>
>
> *Darryl Baker, *GSEC, GCLD (he/him/his)
>
> Sr. System Administrator
>
> Distributed Application Platform Services
>
> *Northwestern University*
>
> 4th Floor
>
> 2020 Ridge Avenue
>
> Evanston, IL 60208-0801
>
> *darryl.baker@northwestern.edu <darryl.baker@northwestern.edu>*
>
> (847) 467-6674 <+18474676674>
>
Re: I need help with a rewrite request [ In reply to ]
Thank you Frank.
That does look like it will do exactly what I want it to do. I am having trouble implementing it. In our development instance I created a .htaccess file with:
<IfModule mod_negotiation.c>
Options +MultiViews
</IfModule>
But when I try to browse to that directory I get a 500 error. I checked and mod_negotiation is loaded globally. So what am I doing wrong?

I am planning on implementing it as part of a Directory definition in my production environment.

Darryl Baker, GSEC, GCLD (he/him/his)
Sr. System Administrator
Distributed Application Platform Services
Northwestern University
4th Floor
2020 Ridge Avenue
Evanston, IL 60208-0801
darryl.baker@northwestern.edu<mailto:darryl.baker@northwestern.edu>
(847) 467-6674<tel:+18474676674>

From: Frank Gingras <thumbs@apache.org>
Reply-To: Apache httpd Users <users@httpd.apache.org>
Date: Wednesday, September 28, 2022 at 8:53 AM
To: Apache httpd Users <users@httpd.apache.org>
Subject: Re: [users@httpd] I need help with a rewrite request

You don't need to use mod_rewrite, a simpler solution is to use multiviews:

https://httpd.apache.org/docs/current/content-negotiation.html#multiviews<https://urldefense.com/v3/__https:/httpd.apache.org/docs/current/content-negotiation.html*multiviews__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!XJEQEVfbwTZi7stzNLfRrLVQHZI0mBENrfdmWohd3iAb69WIu4jZtlaCNJXxkE91crpJBeVzx9NOMlK0bvX7NarK$>

On Wed, 28 Sept 2022 at 09:18, Darryl Philip Baker <darryl.baker@northwestern.edu<mailto:darryl.baker@northwestern.edu>> wrote:
I have just received a request to rewrite everything http://school.northwestern.edu/faculty/name/ to http://school.northwestern.edu/faculty/name.html I believe I can bury this rule in a directory declaration for the faculty directory but I am having problems writing the exact rules to make the transform happen. My stumbling block is I do very few new rewrite rules. Most are simple modifications of existing rules. Please help.

Darryl Baker, GSEC, GCLD (he/him/his)
Sr. System Administrator
Distributed Application Platform Services
Northwestern University
4th Floor
2020 Ridge Avenue
Evanston, IL 60208-0801
darryl.baker@northwestern.edu<mailto:darryl.baker@northwestern.edu>
(847) 467-6674<tel:+18474676674>
Re: I need help with a rewrite request [ In reply to ]
I just was rereading the Multiview definition again, for the umpteenth time, and noticed that it may not work for my problem. The original URL is https://school.northwestern.edu/faculty/name/<https://scholl.northwestern.edu/faculty/name/> and the file that exists URL is https://school.northwestern.edu/faculty/name.html. Notice that the original URL ends in a slash so it appears as a directory and not a file. The target of the rewrite or redirect is one directory level up in a file with the name of the terminating directory in the original but has a name ending in .html.

Darryl Baker
Northwestern University

From: Darryl Philip Baker <darryl.baker@northwestern.edu>
Reply-To: Apache httpd Users <users@httpd.apache.org>
Date: Wednesday, September 28, 2022 at 11:47 AM
To: Apache httpd Users <users@httpd.apache.org>
Subject: Re: [users@httpd] I need help with a rewrite request

Thank you Frank.
That does look like it will do exactly what I want it to do. I am having trouble implementing it. In our development instance I created a .htaccess file with:
<IfModule mod_negotiation.c>
Options +MultiViews
</IfModule>
But when I try to browse to that directory I get a 500 error. I checked and mod_negotiation is loaded globally. So what am I doing wrong?

I am planning on implementing it as part of a Directory definition in my production environment.

Darryl Baker, GSEC, GCLD (he/him/his)
Sr. System Administrator
Distributed Application Platform Services
Northwestern University
4th Floor
2020 Ridge Avenue
Evanston, IL 60208-0801
darryl.baker@northwestern.edu<mailto:darryl.baker@northwestern.edu>
(847) 467-6674<tel:+18474676674>

From: Frank Gingras <thumbs@apache.org>
Reply-To: Apache httpd Users <users@httpd.apache.org>
Date: Wednesday, September 28, 2022 at 8:53 AM
To: Apache httpd Users <users@httpd.apache.org>
Subject: Re: [users@httpd] I need help with a rewrite request

You don't need to use mod_rewrite, a simpler solution is to use multiviews:

https://httpd.apache.org/docs/current/content-negotiation.html#multiviews<https://urldefense.com/v3/__https:/httpd.apache.org/docs/current/content-negotiation.html*multiviews__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!XJEQEVfbwTZi7stzNLfRrLVQHZI0mBENrfdmWohd3iAb69WIu4jZtlaCNJXxkE91crpJBeVzx9NOMlK0bvX7NarK$>

On Wed, 28 Sept 2022 at 09:18, Darryl Philip Baker <darryl.baker@northwestern.edu<mailto:darryl.baker@northwestern.edu>> wrote:
I have just received a request to rewrite everything http://school.northwestern.edu/faculty/name/ to http://school.northwestern.edu/faculty/name.html I believe I can bury this rule in a directory declaration for the faculty directory but I am having problems writing the exact rules to make the transform happen. My stumbling block is I do very few new rewrite rules. Most are simple modifications of existing rules. Please help.

Darryl Baker, GSEC, GCLD (he/him/his)
Sr. System Administrator
Distributed Application Platform Services
Northwestern University
4th Floor
2020 Ridge Avenue
Evanston, IL 60208-0801
darryl.baker@northwestern.edu<mailto:darryl.baker@northwestern.edu>
(847) 467-6674<tel:+18474676674>
Re: I need help with a rewrite request [ In reply to ]
In that case, you can leverate RedirectMatch which will allow you to
capture "name", and redirect to name.html with the rest of the URL.

On Wed, 28 Sept 2022 at 16:45, Darryl Philip Baker <
darryl.baker@northwestern.edu> wrote:

> I just was rereading the Multiview definition again, for the umpteenth
> time, and noticed that it may not work for my problem. The original URL is
> https://school.northwestern.edu/faculty/name/
> <https://scholl.northwestern.edu/faculty/name/> and the file that exists
> URL is https://school.northwestern.edu/faculty/name.html. Notice that the
> original URL ends in a slash so it appears as a directory and not a file.
> The target of the rewrite or redirect is one directory level up in a file
> with the name of the terminating directory in the original but has a name
> ending in .html.
>
>
>
> *Darryl Baker*
>
> *Northwestern University*
>
>
>
> *From: *Darryl Philip Baker <darryl.baker@northwestern.edu>
> *Reply-To: *Apache httpd Users <users@httpd.apache.org>
> *Date: *Wednesday, September 28, 2022 at 11:47 AM
> *To: *Apache httpd Users <users@httpd.apache.org>
> *Subject: *Re: [users@httpd] I need help with a rewrite request
>
>
>
> Thank you Frank.
>
> That does look like it will do exactly what I want it to do. I am having
> trouble implementing it. In our development instance I created a .htaccess
> file with:
>
> <IfModule mod_negotiation.c>
>
> Options +MultiViews
>
> </IfModule>
>
> But when I try to browse to that directory I get a 500 error. I checked
> and mod_negotiation is loaded globally. So what am I doing wrong?
>
>
>
> I am planning on implementing it as part of a Directory definition in my
> production environment.
>
>
>
> *Darryl Baker, *GSEC, GCLD (he/him/his)
>
> Sr. System Administrator
>
> Distributed Application Platform Services
>
> *Northwestern University*
>
> 4th Floor
>
> 2020 Ridge Avenue
>
> Evanston, IL 60208-0801
>
> *darryl.baker@northwestern.edu <darryl.baker@northwestern.edu>*
>
> (847) 467-6674 <+18474676674>
>
>
>
> *From: *Frank Gingras <thumbs@apache.org>
> *Reply-To: *Apache httpd Users <users@httpd.apache.org>
> *Date: *Wednesday, September 28, 2022 at 8:53 AM
> *To: *Apache httpd Users <users@httpd.apache.org>
> *Subject: *Re: [users@httpd] I need help with a rewrite request
>
>
>
> You don't need to use mod_rewrite, a simpler solution is to use multiviews:
>
>
>
> https://httpd.apache.org/docs/current/content-negotiation.html#multiviews
> <https://urldefense.com/v3/__https:/httpd.apache.org/docs/current/content-negotiation.html*multiviews__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!XJEQEVfbwTZi7stzNLfRrLVQHZI0mBENrfdmWohd3iAb69WIu4jZtlaCNJXxkE91crpJBeVzx9NOMlK0bvX7NarK$>
>
>
>
> On Wed, 28 Sept 2022 at 09:18, Darryl Philip Baker <
> darryl.baker@northwestern.edu> wrote:
>
> I have just received a request to rewrite everything
> http://school.northwestern.edu/faculty/name/ to
> http://school.northwestern.edu/faculty/name.html I believe I can bury
> this rule in a directory declaration for the faculty directory but I am
> having problems writing the exact rules to make the transform happen. My
> stumbling block is I do very few new rewrite rules. Most are simple
> modifications of existing rules. Please help.
>
>
>
> *Darryl Baker, *GSEC, GCLD (he/him/his)
>
> Sr. System Administrator
>
> Distributed Application Platform Services
>
> *Northwestern University*
>
> 4th Floor
>
> 2020 Ridge Avenue
>
> Evanston, IL 60208-0801
>
> *darryl.baker@northwestern.edu <darryl.baker@northwestern.edu>*
>
> (847) 467-6674 <+18474676674>
>
>