Welcome Guest, Not a member yet? Register   Sign In
.htacces, mod_rewrite check
#1

[eluser]Chicken's Egg[/eluser]
Is there a possibility to check whether or not a .htaccess-file is actually used? My .htaccess-file looks like:

Code:
RewriteEngine on

# Base URL
RewriteBase  /mysite/

# Options +FollowSymlinks
# Controleer of het geen bestaand directory is
RewriteCond %{REQUEST_FILENAME} !-d
# Controleer of het geen bestaand bestand is
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php|media|maatschappijleer|mysqladmin|usage|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

When I type the url http://localhost/mysite/index.php/news/ it works as expected, but http://localhost/mysite/news/ doesn't work. I got an Apache-error page. I tried it like this aswell:

Code:
RewriteRule ^news$ index.php/news/$1 [L]

But without result. In my Apache configuration file the mod_rewrite module is loaded:
LoadModule rewrite_module modules/mod_rewrite.so

I have used this .htaccess file successfully before, so I guess there is just something wrong with my Apache configuration.

Apache/2.0.63 (Win32)
PHP/5.2.6
Server at localhost Port 80
#2

[eluser]Sam Dark[/eluser]
Check your httpd.conf. "AllowOverride all" must be inside <Directory that is pointing to your project root.
#3

[eluser]Daniel Walton[/eluser]
Shouldn't it be:

Code:
RewriteRule ^(.*)$ /index.php/$1 [L]

note the / before index.php
#4

[eluser]bradym[/eluser]
[quote author="Daniel Walton" date="1215373595"]Shouldn't it be:

Code:
RewriteRule ^(.*)$ /index.php/$1 [L]

note the / before index.php[/quote]

That would work if the CI install was in the root level of the site, but in this case it's in the mysite folder as shown by:

Code:
# Base URL
RewriteBase  /mysite/
#5

[eluser]Chicken's Egg[/eluser]
@Sam Dark:
I have done a reinstall of Apache (this time version 2.2.4) and PHP 5.2.6. The error returned but your solution worked fine. I checked my httpd.conf and found “AllowOverride" to be "None" instead of 'All'. Thank you very much!

In the access.log I see a line like:
127.0.0.1 - - [07/Jul/2008:09:07:39 +0200] "GET /mysite/admin/ HTTP/1.1" 200 12
I know that the 200 means that everything has gone all-right. I'm not sure of the number 12 though.

And when I startup my webserver there are a lot of lines logged in the error.log. This morning for example:
[Mon Jul 07 09:07:34 2008] [notice] Parent: Received restart signal -- Restarting the server.
[Mon Jul 07 09:07:34 2008] [notice] Child 1484: Exit event signaled. Child process is ending.
[Mon Jul 07 09:07:34 2008] [notice] Apache/2.2.4 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Mon Jul 07 09:07:34 2008] [notice] Server built: Jan 9 2007 23:17:20
[Mon Jul 07 09:07:34 2008] [notice] Parent: Created child process 3332
[Mon Jul 07 09:07:34 2008] [notice] Child 3332: Child process is running
[Mon Jul 07 09:07:35 2008] [notice] Child 1484: Released the start mutex
[Mon Jul 07 09:07:35 2008] [notice] Child 3332: Acquired the start mutex.
[Mon Jul 07 09:07:35 2008] [notice] Child 3332: Starting 250 worker threads.
[Mon Jul 07 09:07:36 2008] [notice] Child 1484: Waiting for 250 worker threads to exit.
[Mon Jul 07 09:07:36 2008] [notice] Child 1484: All worker threads have exited.
[Mon Jul 07 09:07:36 2008] [notice] Child 3332: Starting thread to listen on port 80.
[Mon Jul 07 09:07:36 2008] [notice] Child 1484: Child process is exiting

Is this something to worry about? Yesterday PHP complained about unfindable modules as well. Errors like 'Cannot find module (IP-MIB): At line 0 in (none)'. I could solve that problem by giving this command in the command prompt of Windows XP: "C:\server\php\php-win.exe rpm -e php-snmp". However I don't know what is does exactly. Hopefully the other 'notices' can be rubbed off as-well.
#6

[eluser]Sam Dark[/eluser]
These are only notices and just indicating what's going on. It seems to be ok. You are done with Apache part.

"Cannot find module" is about php.conf. Maybe you haven't specified modules path or loading a non existent module.
#7

[eluser]Chicken's Egg[/eluser]
[quote author="Sam Dark" date="1215434372"]These are only notices and just indicating what's going on. It seems to be ok. You are done with Apache part.
[/quote]
Okay, I'm glad to read that.

[quote author="Sam Dark" date="1215434372"]"Cannot find module" is about php.conf. Maybe you haven't specified modules path or loading a non existent module.[/quote]
Well the other modules are loaded correctly and I checked the modulepath three times. It attracted my attention that all those unfindable modules logged in the error.log-file where not loaded in the php.ini-file. But like I wrote, the command 'C:\server\php\php-win.exe rpm -e php-snmp' helpt me out. Even though I don't know what I've done. Now I don't have to worry about the notices anymore, I can install MySQL and start playing with CodeIgniter.




Theme © iAndrew 2016 - Forum software by © MyBB