Welcome to WebmasterWorld Guest from 54.159.44.227

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Need help in configuration the server

or is it the .htacces file?

     

Philarmon

7:52 pm on Mar 25, 2005 (gmt 0)

10+ Year Member



Hi!

I have just got my first own server. Well, not a dedicated one, but a VPS Root :) But its still cool.

I am new to all this server stuff so i ordered a PLESK control panel with it but it seems still not help me.

I have a website on it where i have the following in my .htaccess:

RewriteCond %{HTTP_HOST} ^www.mydomain\.com
RewriteRule ^index.php$ [mydomain.com...] [L]

On my old shared hosting it redirected all www.mydomain.com requests to the cgi script and all did worked fine.

Now i am getting an "Access forbidden!" error because there is no index.html file and it does not redirect anymore.

Now i am unsure if there is some setting on the server i need or is there a trick in the .htaccess to do. All other redirects to subpages work fine and also if i type www.mydomain.com/index.php it works.

Thanks for your help!

sitz

8:47 pm on Mar 25, 2005 (gmt 0)

10+ Year Member



In order for mod_rewrite to work in a .htaccess file, several things must happen:

1) the mod_rewrite module must be loaded in the server config (this is true for (*any* rule, .htaccess or not)

2) The 'FileInfo' option for the AllowOverride config option must be in force for the directory your .htaccess file is in

3) The first rewrite line in the .htaccess file SHOULD be 'RewriteEngine on'

You'll need to check your httpd.conf for the first two; note that if you *do* have write access to httpd.conf, that is far and away the preferred place to have your Rewrite lines; the performance hit for using them in .htaccess is significant.

Philarmon

9:05 pm on Mar 25, 2005 (gmt 0)

10+ Year Member



The mod_rewrite is on - as i said, it works for all other subpages.

Meanwhile, i have found out a simple solution so simple that i didn't thought about it:

RewriteRule ^$ [hitscreen.com...] [L]

Anyway, thanks for the suggestions and your time ;)

sitz

3:52 am on Mar 26, 2005 (gmt 0)

10+ Year Member



Be advised that that solution will work as long as people don't try and arrive at your site by typing/clicking to "http://www.mydomain.com/index.php"; it will fail the regex match. To account for both of these:

RewriteEngine on
RewriteRule ^($Žindex.php$) http://www.mydomain.com/cgi-bin/x.cgi [R,L]

(Yes, the 'R' is optional, since you're specifying a target path prefixed with 'http://'; I personally prefer to be explicit about this sort of thing as it makes the rules (slightly) more self-documenting).
 

Featured Threads

Hot Threads This Week

Hot Threads This Month