kevinvw1
asked on
Apache - friendly urls and mod_rewrite issue
NOTE: I am working with Phalcon tutorial -
http://docs.phalconphp.com/en/latest/reference/apache.html
This is Apache on Windows.
I have a web page that I can browse to with no issues -
https://localhost:8443/tutorial/index.php
I have set up the rewrite rules in the httpd.conf file (not using .htaccess) -
<IfModule mod_rewrite.c>
<Directory "c:/Apache24/htdocs/tutori al">
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</Directory>
<Directory "c:/Apache24/htdocs/tutori al/public" >
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</Directory>
</IfModule>
But when I browse to https://localhost:8443/tutorial/
I get the directory listing of the public folder -
Index of /tutorial/public
Parent Directory
css/
img/
index.php
js/
It takes me to the public folder so it seems that part of the rewrite is working.
Any ideas what I'm missing?
Thanks,
Kevin.
http://docs.phalconphp.com/en/latest/reference/apache.html
This is Apache on Windows.
I have a web page that I can browse to with no issues -
https://localhost:8443/tutorial/index.php
I have set up the rewrite rules in the httpd.conf file (not using .htaccess) -
<IfModule mod_rewrite.c>
<Directory "c:/Apache24/htdocs/tutori
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</Directory>
<Directory "c:/Apache24/htdocs/tutori
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</Directory>
</IfModule>
But when I browse to https://localhost:8443/tutorial/
I get the directory listing of the public folder -
Index of /tutorial/public
Parent Directory
css/
img/
index.php
js/
It takes me to the public folder so it seems that part of the rewrite is working.
Any ideas what I'm missing?
Thanks,
Kevin.
ASKER
Thanks. But isn't that what the 2nd rewrite rule is supposed to do?
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Phil, I removed that RewriteCond line and it worked. I am still not sure why.
Maybe it is my Apache on Windows? Or something else I have configured incorrectly.
@Ray - I am having same issue with Laravel -
Laravel has the pretty much the exact same rewrite -
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
AFAIK, both Laravel and Phalcon rely on their own custom routing.
I am going to try this on Linux and see if it behaves as expected.
Thanks for all the help.
Maybe it is my Apache on Windows? Or something else I have configured incorrectly.
@Ray - I am having same issue with Laravel -
Laravel has the pretty much the exact same rewrite -
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
AFAIK, both Laravel and Phalcon rely on their own custom routing.
I am going to try this on Linux and see if it behaves as expected.
Thanks for all the help.
Open in new window