|
|||
|
Hello,
I' cannot redirect in my public folder because of my .htaccess file. If I rename the .htaccess, it works. But I need the .htaccess to route my requests to index.php That's the content of my .htaccess Code:
RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php It's an URL redirect. I've got 2 Domains, and one with webspace. The other schould be redirected in an folder of my webspace. Thanks in advance. Regards Steffen |
|
|||
|
Just use the alternate method for .htaccess:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [QSA,L]
Just be aware that you can't name a controller in ZF app that is the same name as a directory in your webspace, as mod_rewrite will never direct it at your ZF app. Hope that answers your question. |
|
|||
|
Quote:
at first, thanks very much. What did you mean with don't actually exist? Aren't in the same folder? Does it just don't work with this .htaccess file or is it generally by using mod_rewrite. Regards from Germany |
|
|||
|
Let me use an example it might help it clear things up:
Let's say your web space is /var/www/html and this is where your .htaccess is located and you used the one I provided above. Now, in that directory you have a folder named "foobar" that actually exists on the filesystem (/var/www/html/foobar/). Using my .htaccess file a request for hxxp://www.yourdomain.com/foobar/ will serve the content from /var/www/html/foobar/. Now hypothetically, lets say you have a Zend Frameworks app also running in the same space (/var/www/html/). Additionally, you have a controller named 'foobar' (/var/www/application/controller/FoobarController.php). My statement above was basically warning you, that any request for the controller foobar, would be sent to the directory (because it exists on the filesystem) and the .htaccess is checking to make sure the requested item doesn't exists (file or directory) before dispatching the request to index.php. So it never makes it to the index.php and Zend Framework. Make sense? Or just more confused? ![]() |
![]() |
| Thread Tools | |
| Display Modes | |
|
|