LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-05-2011, 12:05 AM   #1
MasterMatt
LQ Newbie
 
Registered: May 2011
Posts: 5

Rep: Reputation: 0
Apache not reading .htacces on 443


Hey first question. I've used Apache for awhile, but my linux isn't all that great.

I'm running the lastest Apache 2.x on Debian, I have mod_rewrite and while I was going some basic testing on port 80 the rewrites in my .htaccess worked fine. Then I setup Apache to force all :80 to :433 and now the .htaccess are not being read.

I've been messing with the AllowOverrides with no change. I've also confirmed that AccessFileName is set to .htaccess. These are my hosts now:

Code:
<VirtualHost *:80>
	ServerAdmin webmaster@example.com

	DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride All
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>

	RewriteEngine On
	RewriteCond %{SERVER_PORT} !^443$
	RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
	LogLevel warn
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
	ServerAdmin webmaster@example.com

	DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride All
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>
        SSL stuff...
</VirtualHost>
</IfModule>
Ideas?
 
Old 05-05-2011, 01:36 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,903

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
Hi,

What's in the .htaccess that is not working?
To test if .htaccess is actually read by apache, you can put some garbage in it and see if you get a 500 error

Regards
 
1 members found this post helpful.
Old 05-05-2011, 02:56 AM   #3
MasterMatt
LQ Newbie
 
Registered: May 2011
Posts: 5

Original Poster
Rep: Reputation: 0
Good call.

When I put garbage in a .htaccess I get an 500 error.

I have a handful of rewrite rules along the lines of:
Code:
RewriteRule ^download\/(.*)$ /get/actions.php?action=download&x=$1 [NC,L]
But I haven't changed any of them since they worked when I was running port 80 and I start the file with RewriteEngine on

Do I have to run the rewrite module separately for the virtual host?

Last edited by MasterMatt; 05-05-2011 at 03:09 AM.
 
Old 05-05-2011, 03:16 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,903

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
So your .htaccess starts with a "RewriteEngine on" but rewrites do not happen. Are you sure that there is not a RewriteCond that is not fulfilled?
You can post the .htaccess to see if we get something
 
Old 05-05-2011, 03:30 AM   #5
MasterMatt
LQ Newbie
 
Registered: May 2011
Posts: 5

Original Poster
Rep: Reputation: 0
Ok, I have it working now, but I'm confused as to why. I had 'RewriteEngine on' on the first line of the .htaccess file in my root. The rewrites in question are in subdirectories. When I added 'RewriteEngine on' to the top all the .htaccess files it works.

I thought Apache parsed every .htaccess file on the path to the script running, ie if I executed www.example.com/hello/world/script.php, it would look for 3 files in the order of root/ root/hello/ root/hello/world/

Is that not right?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache redirect from 80 to 443 gabsik Linux - Networking 31 06-18-2006 07:37 AM
Apache Port 443 Verbal Kint Linux - Software 0 10-04-2005 04:07 AM
apache mod_ssl not using port 443 davidsrsb Slackware 8 06-07-2005 11:33 AM
Apache: trouble with .htacces dowski Linux - Software 9 05-18-2004 12:58 AM
apache .htacces LabRad Linux - Software 2 08-04-2003 05:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration