Koozali.org: home of the SME Server

I need an example of a Mod_Rewrite

Offline fixit

  • *
  • 216
  • +0/-0
    • http://www.fixitcomputers.com.au
I need an example of a Mod_Rewrite
« on: March 15, 2006, 03:14:23 AM »
I would like an example of a Mod_Rewrite for something like this

www.mydomain.com.au/metadot/index.pl

how would I remove the /metadot from the url that is displayed in the address bar to display something like

www.mydomain.com.au/index.pl

Thanks, Russell
.........

Offline gordonr

  • *
  • 646
  • +0/-0
    • http://www.smeserver.com.au/
Re: I need an example of a Mod_Rewrite
« Reply #1 on: March 15, 2006, 08:12:30 AM »
Quote from: "fixit"
I would like an example of a Mod_Rewrite for something like this

www.mydomain.com.au/metadot/index.pl

how would I remove the /metadot from the url that is displayed in the address bar to display something like

www.mydomain.com.au/index.pl

Thanks, Russell


See /etc/httpd/conf/httpd.conf for quite a few examples, and here for the gory details:

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

In your case, you can probably use a URL of the form:

www.mydomain.com/foobar/

and use Alias or ScriptAlias to point to the real path.
............

Offline fixit

  • *
  • 216
  • +0/-0
    • http://www.fixitcomputers.com.au
I need an example of a Mod_Rewrite
« Reply #2 on: March 16, 2006, 09:06:05 AM »
OK, I got my example of Rewrite rule to remove metadot from the url. Now how do i go about creating it. Do I create a custom template or create a htaccess file

Example;

 # Rewrite rule to remove /metadot/
RewriteCond  %{HTTP_HOST} www.metadot.com
RewriteRule ^/index.pl(.*) /metadot/index.pl$1 [PT]

RewriteCond  %{HTTP_HOST} www.metadot.com
RewriteRule ^/userchannel.pl(.*) /metadot/userchannel.pl$1 [PT]

Thanks, Russell
.........

Offline kingjm

  • ***
  • 55
  • +0/-0
    • www.iking.ca
mod_rewrite for metatdot
« Reply #3 on: June 02, 2006, 06:20:43 PM »
I think it would be better to make a template fragment
/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf

but could we not just use
Alias       /        /home/e-smith/files/ibays/primary/html/metatdot

in this file

I have never made a custom template, so I am trying to figure out this at the same time... feel free to add or change anything