Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-02-2008, 05:56 PM
Junior Member
 
Join Date: Jun 2008
Posts: 3
Default Redirect problem because of .htaccess file

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
Can you help me how I can do it alternatively?

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-02-2008, 08:13 PM
Junior Member
 
Join Date: Jun 2008
Posts: 2
Default

Just use the alternate method for .htaccess:

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [QSA,L]
That will redirect all requests for items that don't actually exist (files and directories) to index.php.

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-04-2008, 06:40 AM
Junior Member
 
Join Date: Jun 2008
Posts: 3
Default

Quote:
Originally Posted by stupidnic View Post
Just use the alternate method for .htaccess:

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [QSA,L]
That will redirect all requests for items that don't actually exist (files and directories) to index.php.

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.
Hello,

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-04-2008, 11:48 PM
Junior Member
 
Join Date: Jun 2008
Posts: 2
Default

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-13-2008, 01:27 PM
Junior Member
 
Join Date: Jun 2008
Posts: 3
Default

OK, I understand.

Thank you very much.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 01:38 PM.