homepage Welcome to WebmasterWorld Guest from 54.234.2.94
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Need help in configuration the server
or is it the .htacces file?
Philarmon




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

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




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

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




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

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




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

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).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved