Welcome to WebmasterWorld Guest from 35.172.111.215

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Changing from AliasMatch to mod_rewrite

using Rewrite to to an AliasMatch

     
9:35 pm on Jan 7, 2004 (gmt 0)

New User

10+ Year Member

joined:Jan 7, 2004
posts:4
votes: 0


Here's the basics. I've written a cgi program in C that can build and entire website using a mysql database. However, to run this I need and alias match to send all url requests (except image requests in the /art/ folder) to showpage.cgi. I can do this with the following in the httpd.conf file:

AliasMatch ^/(?!art\/) (.*) /virtual/newtusa/showpage.cgi

I'm trying to host a site based of of the showpage.cgi templating engint on an online, but since I don't have access to the httpd.conf I need to figure out another way to route all url requests to the script using mod_rewrite (or anything that will accomplish the same thing). Any ideas? Thanx

1:14 am on Jan 8, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Pennoc,

Welcome to WebmasterWorld [webmasterworld.com]!

Lacking further details, here's a more-or-less straight translation, including setup:


Options +FollowSymLinks
RewriteBase /
RewriteEngine on
RewriteRule !^art/ /virtual/newtusa/showpage.cgi [L]

Depending on the existing httpd.conf, you may or may not need the Options and RewriteBase directives, and the latter may need to be adjusted depending on the local path to your web root directory.

Note that the leading slash is omitted in RewritRule patterns in the .htaccess context.

Jim

5:38 pm on Jan 8, 2004 (gmt 0)

New User

10+ Year Member

joined:Jan 7, 2004
posts:4
votes: 0


Thanx for the quick reply. I was trying something similar to that but haven't had any success. I couldn't get your RewriteRule to work either.

RewriteRule!^art/ /virtual/newtusa/showpage.cgi [L]

Any reference to an actual system folder fails producing error 500. I can however rewrite to another url.

RewriteRule!^art/ http://www.example.com [L]

Is there a reason for this? Some server setting that denies me from referring directly to a file? Or is it a permisions issue?

Just to try to give you a little more info, the cgi script relies on the url for information. I'm currently using it to run http://www.example.com (no need to point out the flaws of the initial design (: ). Data is passed to the script through the url, which gives the information needed to draw a dynamic page, as well as appear static so that search engines can index the site. I need to find a way to preserve this functionality using the .htaccess file instead of an AliasMatch in the httpd.conf. Thanx Again

[edited by: jdMorgan at 9:00 pm (utc) on Jan. 8, 2004]
[edit reason] Removed specifics [/edit]

8:58 pm on Jan 8, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Pennoc,

From msg#2 above: "you may or may not need the Options and RewriteBase directives"

In addition, you may need to set the [PT] flag, so that mod_rewrite output will be in URL form, rather than local filepath form.

If you are getting 500 errors, what does your error log say? - The info in the error log will often show you exactly how to fix the problem

Please review our Terms of Service [webmasterworld.com] - we don't post specific URLs or do site reviews here at WebmasterWorld. Thanks. :)

Jim