Redirecting with Apache

Hi,

My question is simple: How can I redirect visitors from www.mywebsite.com to www.mywebsite.com/cgi-bin/script.cgi, using Apache ?

Thanks
agubairaAsked:
Who is Participating?
 
xDamoxConnect With a Mentor Commented:
Hi,

you could try:

RewriteEngine on
RewriteRule ^index\.html$ /cgi-bin/script.cgi
0
 
xDamoxCommented:
Hi,

I would suggest using mod_rewrite check it out:

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

heres a little demo code:

#
#  /abc/def/.htaccess -- per-dir config file for directory /abc/def
#  Remember: /abc/def is the physical path of /xyz, i.e., the server
#            has a 'Alias /xyz /abc/def' directive e.g.
#

RewriteEngine On

#  let the server know that we were reached via /xyz and not
#  via the physical path prefix /abc/def
RewriteBase   /xyz

#  now the rewriting rules
RewriteRule   ^oldstuff\.html$  newstuff.html
0
 
agubairaAuthor Commented:
Is there a way to do it with "Redirect" instead ? I don't understand the rule, how would it be in my case ?

Thanks
0
 
agubairaAuthor Commented:
It worked beautifully ! Thanks dude.
0
All Courses

From novice to tech pro — start learning today.