Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite Help needed

         

cdmn

11:57 am on Feb 21, 2007 (gmt 0)

10+ Year Member



Hi there,
im lost... need some help :)

I have access configuration like this:


<Directory "/home/user/public_html/">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>

index.php is set to print out $_SERVER['PATH_INFO'].

... So if i access URI like this: URI/index.php/a/b/c, i get "a/b/c", if like this: URI/a/b/c (and this should work), i get:

The requested URL /index.php/a/b/c/ was not found on this server.

How i understand "a/b/c" is send to index.php, so RewriteRule works?
But why does it not work as expected (print out "a/b/c")...

[edited by: jdMorgan at 2:39 pm (utc) on Feb. 21, 2007]
[edit reason] Spelling. [/edit]

jdMorgan

2:46 pm on Feb 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If this code is located in httpd.conf or other server-config-level file, as I assume it is because you are using <Directory>, then the URL-path seen by RewriteRule will have a leading slash which must either be matched in the RewriteRule pattern or must be omitted from the substitution:

<Directory "/home/user/public_html/">
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRu[b]le ^/(.[/b]*)$ index.php/$1 [L]
</Directory>

(See also AcceptPathInfo in Apache core for a different solution)

Jim

cdmn

11:48 am on Feb 26, 2007 (gmt 0)

10+ Year Member



Hi,

thanks for your answer, jdMorgan.
But sadly it didnt solved my problem....

Configuration is located in access.conf file.

If i do as you sad:

<Directory "/home/user/public_html/">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^/(.*)$ index.php/$1 [L]
</Directory>

i get:

The requested URL /a/b/c/ was not found on this server.

If i ommit slashes:

<Directory "/home/user/public_html">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>

i get:

The requested URL /index.php/a/b/c/ was not found on this server.

jdMorgan

3:39 pm on Feb 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So the second rule is working, and rewriting the URL as you wish. However, it appears that you do not have AcceptPathInfo set on your server. As I wrote above:

> (See also AcceptPathInfo in Apache core for a different solution)

Jim

cdmn

10:17 am on Mar 6, 2007 (gmt 0)

10+ Year Member



Thanks again :-)

Solved the problem!