Regarding the htaccess and ZF

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BornForCode
Forum Contributor
Posts: 147
Joined: Mon Feb 11, 2008 1:56 am

Regarding the htaccess and ZF

Post by BornForCode »

Hello:

This works fine: http://house.bornforcode.com/html/
Or this: http://house.bornforcode.com/html/index/index

But this is not working: http://house.bornforcode.com/html/login/index

My htaccess file:

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
User avatar
Sekka
Forum Commoner
Posts: 91
Joined: Mon Feb 18, 2008 10:25 am
Location: Huddersfield, West Yorkshire, UK

Re: Regarding the htaccess and ZF

Post by Sekka »

I take it you want to implement what I call 'virtual' URLs?

This is the .htaccess code I use,

Code: Select all

# Fix requests for directories without last slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule (.*) /$1/ [R=301,L]
 
# 'Virtual' URL forwarding
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ index.php [L,QSA]
Then, I use $_SERVER['REQUEST_URI'] and parse it to determine what URL they were requesting and display the appropriate page.

This make sense?
Post Reply