Link to home
Start Free TrialLog in
Avatar of agubaira
agubaira

asked on

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
Avatar of xDamox
xDamox
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of agubaira
agubaira

ASKER

Is there a way to do it with "Redirect" instead ? I don't understand the rule, how would it be in my case ?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of xDamox
xDamox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It worked beautifully ! Thanks dude.