Re: Re: Preserving URL after redirect?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Skip Evans wrote:
> (Apologies to Shawn for sending this directly to him and not the entire
> list, that was an accident. Here it is for the list.)
> 
> Shawn McKenzie wrote:
> <SNIP!>
>>
>> Rewrite rule would look something like:
>>
>> <IfModule mod_rewrite.c>
>>     RewriteEngine On
>>     RewriteCond %{REQUEST_FILENAME} !-d
>>     RewriteCond %{REQUEST_FILENAME} !-f
>>     RewriteRule ^(.*)$ index.php?path=$1 [QSA,L]
>> </IfModule>
>>
>> -Shawn
>>
> 
> My httpd.conf file has this
> 
> LoadModule rewrite_module
> libexec/apache2/mod_rewrite.so
> 
> But your .htaccess sample has
> 
> IfModule mod_rewrite.c
> 
> Is that okay?
> 

It Works for me and I have the same mod_rewrite.so line.  Not sure the
specifics of why this is as it is.

> Also, it does look like .htaccess is enabled in
> httpd.conf with entries like:
> 
> #
> # AllowOverride controls what directives may be
> placed in .htaccess files.
> # It can be "All", "None", or any combination of
> the keywords:
> #   Options FileInfo AuthConfig Limit
> #
>     AllowOverride All
> 
> #
> # AccessFileName: The name of the file to look for
> in each directory
> # for additional configuration directives.  See
> also the AllowOverride
> # directive.
> #
> AccessFileName .htaccess
> 
> But when I tried out Shawn's file I got 404 errors
> on the URLs (after renaming the wi directory, to
> be sure the .htaccess file was in control.)
> 
> Any suggestions would be greatly appreciated.
> 
> I'm going through a pretty good page on htaccess files at
> 
> http://corz.org/serv/tricks/htaccess2.php
> 
> But it starts off with "Make no mistake, mod_rewrite is complex."
> 
> *gulp!*
> 
> Skip
> 
So you have the .htaccess file in the root dir alongside the index.php?

I just tested and this is working for me.  What I posted rewrites
everything to index.php so if you have other php pages that are loaded
by the browser then you would need better rules in .htaccess.

To see more you might add the following and then check the log:

RewriteLog "/somepath/rewrite.log"
RewriteLogLevel 3


-Shawn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux