Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 28th December 2005, 23:09
kingkunt kingkunt is offline
Junior Member
 
Join Date: Dec 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default apache & mod_rewrite problems

Hi im running suse9.3 perfect setup
my problem is when a script is installed its using .htaccess files to control the virtual urls,
ie: http://site.com/register
not http://site.com/register.php
my apache installation shows mod_rewrite in the phpinfo but the urls are not working?
Does anyone have any idea how i can possibly find out what the problem is?
Quote:
<Files *.xslt>
SetHandler text/xml
</Files>

<IfModule !mod_php4.c>

<IfModule !mod_php5.c>

# PHP is in CGI Mode, so we need a different mod_rewrite

RewriteCond %{REQUEST_URI} !categories\.php
RewriteRule ^categories(.*) categories.php?$1 [L]

RewriteCond %{REQUEST_URI} !articles\.php
RewriteRule ^articles(.*)$ articles.php?$1 [L]
here is a sample of the .htaccess file controling the urls.
thanks in advance
Reply With Quote
Sponsored Links
  #2  
Old 28th December 2005, 23:20
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts
Default

Does your .htaccess file contains this line:

RewriteEngine On

to enable the rewrite engine before the part with the rewrite rules?

At the end of your httpd.conf is a section which limits the permissions for htaccess files:

Code:
<Directory /home/www/*/web>
    Options +Includes +FollowSymlinks -Indexes
    AllowOverride Indexes AuthConfig Limit FileInfo
    Order allow,deny
    Allow from all

    <Files ~ "^\.ht">
    Deny from all
    </Files>
</Directory>
Maybe you must extend the allow override settings or set it even to:

AllowOverride All

But be aware that this is an security risk if you host websites for customers on your server.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.

Last edited by till; 28th December 2005 at 23:22.
Reply With Quote
  #3  
Old 28th December 2005, 23:24
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,751 Times in 2,581 Posts
Default

What's in the Apache logs (access.log and error.log) when you try to access http://site.com/register ?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #4  
Old 29th December 2005, 01:27
kingkunt kingkunt is offline
Junior Member
 
Join Date: Dec 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

RewriteEngine On is at the top of the .htaccess
I checked the error.log and i this is the error displayed when i view the pages,
Quote:
/home/www/web1/web/test/.htaccess: Options not allowed here
with the .htaccess file in place i get 500 internal server error.
When i remove it i can see the pages but all links are missing the .php extension.
heres the error log for when i click the link with no .php extension
Quote:
File does not exist: /home/www/web1/web/test/news, referer: http://site.com/test/
Reply With Quote
  #5  
Old 29th December 2005, 10:26
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts
Default

Have you set "AllowOverride All" in your httpd.conf (can also be named apache.conf or apache2.conf depending on your linux distribution) as i described above? It should fix your .htaccess problem. Dont forget to restart your apache server after the change of httpd.conf.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #6  
Old 29th December 2005, 11:35
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,751 Times in 2,581 Posts
Default

Normally rewrite rules should work in an ISPConfig web site ( http://www.howtoforge.com/forums/showthread.php?t=38 ).
I guess one of the other directives is causing problems. Can you remove anything but what is related to mod_rewrite from the .htaccess file and try again?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 2nd January 2006, 21:24
kingkunt kingkunt is offline
Junior Member
 
Join Date: Dec 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i set the httpd.conf files .htaccess settings to allowoveride all and i still get a 500 internal server error?

Code:
Options +FollowSymlinks
RewriteEngine On

AddType text/xml .xslt

<Files *.xslt>
	SetHandler text/xml
</Files>

<IfModule !mod_php4.c>

	<IfModule !mod_php5.c>

		# PHP is in CGI Mode, so we need a different mod_rewrite

		RewriteCond %{REQUEST_URI} !categories\.php
		RewriteRule ^categories(.*) categories.php?$1 [L]
		
		RewriteCond %{REQUEST_URI} !articles\.php
		RewriteRule ^articles(.*)$ articles.php?$1 [L]
		
		RewriteCond %{REQUEST_URI} !pages\.php
		RewriteRule ^pages(.*)$ pages.php?$1 [L]
		
		RewriteCond %{REQUEST_URI} !blogs\.php
		RewriteRule ^blogs(.*)$ blogs.php?$1 [L]
		
		RewriteCond %{REQUEST_URI} !search.php
		RewriteRule ^search(.*)$ search\.php?$1 [L]
		
		RewriteCond %{REQUEST_URI} !authors.php
		RewriteRule ^authors(.*)$ authors\.php?$1 [L]
		
		RewriteCond %{REQUEST_URI} !articlerss.php
		RewriteRule ^articlerss(.*)$ articlerss\.php?$1 [L]
		
		RewriteCond %{REQUEST_URI} !news.php
		RewriteCond %{REQUEST_URI} !newsrss.php
		RewriteRule ^news(.*)$ news.php?$1 [L]
		
		RewriteCond %{REQUEST_URI} !contact.php
		RewriteRule ^contact(.*)$ contact\.php?$1 [L]
		

	</IfModule>

	<IfModule mod_php5.c>
		
		# Using PHP 5 in module mode

		RewriteCond %{REQUEST_URI} categories.*
		RewriteRule ^categories(.*)$ categories.php?$1 [T=application/x-httpd-php,L]

		RewriteCond %{REQUEST_URI} articles.*
		RewriteRule ^articles(.*)$ articles.php?$1 [T=application/x-httpd-php,L]

		RewriteCond %{REQUEST_URI} pages.*
		RewriteRule ^pages(.*)$ pages.php?$1 [T=application/x-httpd-php,L]

		RewriteCond %{REQUEST_URI} blogs.*
		RewriteRule ^blogs(.*)$ blogs.php?$1 [T=application/x-httpd-php,L]

		RewriteCond %{REQUEST_URI} search.*
		RewriteRule ^search(.*)$ search.php?$1 [T=application/x-httpd-php,L]

		RewriteCond %{REQUEST_URI} authors.*
		RewriteRule ^authors(.*)$ authors.php?$1 [T=application/x-httpd-php,L]

		RewriteCond %{REQUEST_URI} articlerss.*
		RewriteRule ^articlerss(.*)$ articlerss.php?$1 [T=application/x-httpd-php,L]

		RewriteCond %{REQUEST_URI} news.*
		RewriteCond %{REQUEST_URI} !newsrss
		RewriteRule ^news(.*)$ news.php?$1 [T=application/x-httpd-php,L]
		
		RewriteCond %{REQUEST_URI} contact.*
		RewriteRule ^contact(.*)$ contact.php?$1 [T=application/x-httpd-php,L]

	</IfModule>

</IfModule>

<IfModule mod_php4.c>

	# PHP 4 in module mode

	RewriteCond %{REQUEST_URI} categories.*
	RewriteRule ^categories(.*)$ categories.php?$1 [T=application/x-httpd-php,L]

	RewriteCond %{REQUEST_URI} articles.*
	RewriteRule ^articles(.*)$ articles.php?$1 [T=application/x-httpd-php,L]

	RewriteCond %{REQUEST_URI} pages.*
	RewriteRule ^pages(.*)$ pages.php?$1 [T=application/x-httpd-php,L]

	RewriteCond %{REQUEST_URI} blogs.*
	RewriteRule ^blogs(.*)$ blogs.php?$1 [T=application/x-httpd-php,L]

	RewriteCond %{REQUEST_URI} search.*
	RewriteRule ^search(.*)$ search.php?$1 [T=application/x-httpd-php,L]

	RewriteCond %{REQUEST_URI} authors.*
	RewriteRule ^authors(.*)$ authors.php?$1 [T=application/x-httpd-php,L]

	RewriteCond %{REQUEST_URI} articlerss.*
	RewriteRule ^articlerss(.*)$ articlerss.php?$1 [T=application/x-httpd-php,L]

	RewriteCond %{REQUEST_URI} news.*
	RewriteCond %{REQUEST_URI} !newsrss
	RewriteRule ^news(.*)$ news.php?$1 [T=application/x-httpd-php,L]
	
	RewriteCond %{REQUEST_URI} contact.*
	RewriteRule ^contact(.*)$ contact.php?$1 [T=application/x-httpd-php,L]

</IfModule>
here is my httpd.conf
Code:
# forbid access to the entire filesystem by default
<Directory />
    Options +Includes +FollowSymlinks -Indexes
    AllowOverride all
    Order allow,deny
    Allow from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
    Deny from all
</Files>
ive tried changing and restarting the apache server with no luck?
Reply With Quote
  #8  
Old 2nd January 2006, 22:34
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts
Default

If you use ISPConfig, the code you posted does not affect the ISPConfig websites at all. You must search for this directory directive
"<Directory /home/www/*/web>" and not for "<Directory />"
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #9  
Old 9th July 2008, 05:29
mspIggy mspIggy is offline
Member
 
Join Date: Jul 2008
Posts: 55
Thanks: 3
Thanked 0 Times in 0 Posts
Default

500 internal server error

i have a fresh install of ISPConfig

i am having this same problem

did you solve yours?

we use several different htaccess files

every one of them gives me the err

500 internal server error

this is mission critial for me...

i cannot even find the file httpd.conf -- what is the server path to this file?

in my old server - we enabled htaccess on a persite basis like this >

<Directory /home/.sites/120/site53/web>
Options -Indexes
AllowOverride All
</Directory>

is thsi something we can use here?

where is the httpd.conf file

thank you
Reply With Quote
  #10  
Old 9th July 2008, 07:36
mspIggy mspIggy is offline
Member
 
Join Date: Jul 2008
Posts: 55
Thanks: 3
Thanked 0 Times in 0 Posts
 
Default

finally i found this

.............

very easy to do!

many thanks to hans
...............................

Probably .htaccess files are not allowed on your system.
You can add the following to the Apache directives field of your website:

<Directory "/var/www/web1/web">
Options FollowSymLinks
AllowOverride All
</Directory>

Where, web1 is your own webnumber.
__________________
Hans
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with groups/grpconv linuxfast General 28 21st April 2008 10:35
PHP/MySQL/Apache2/ISPConfig configuration issues? senzapaura General 21 25th December 2005 15:01
install apache 1.3 on FC 4 superg Server Operation 1 22nd December 2005 18:44
Apache 1.3 Support SleeperZ General 3 9th November 2005 12:10
Apache from source on SuSE 9 Brenton Server Operation 1 25th July 2005 19:40


All times are GMT +2. The time now is 23:39.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.