Click to See Complete Forum and Search --> : .htaccess in zend studio


teguh123
07-09-2008, 10:11 AM
Hello,

I used a certain type of .htaccess that redirect all url to index.php

That doesn't work in zend studio though.

What's wrong?

bpat1434
07-09-2008, 12:19 PM
Define "doesn't work". As in you're doing the profiling or debugging of your scripts and requests don't get filtered through the .htaccess?

teguh123
07-09-2008, 12:33 PM
If I go to http://localhost/somedirectory/index.php the program works

If I go to http://localhost/somedirectory/whatever/something.htm I got a 404 error saying that there is no such file.

It's true that there is no such file. However, I have a .htaccess files there

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

bpat1434
07-09-2008, 12:36 PM
So you only want to catch those requests that aren't valid files or directories? I would venture a guess as to say you might need to remove the RewriteBase from it.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php [L]

teguh123
07-09-2008, 01:44 PM
Oh okay.

teguh123
07-09-2008, 01:46 PM
Still doesn't work.

My .htaccess is now like this


# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

teguh123
07-11-2008, 01:28 AM
That is the same .htaccess I used in my sites. In my sites it's workin fine.

http://domainname.com/whatever will just act as if I am accessing http://domainname.com/index.php

bretticus
07-11-2008, 02:02 AM
I think the easiest way to do this (especially since you may not have access to the apache config files, just .htaccess) is to use the Files directive and ForceType

<Files articles>
ForceType application/x-httpd-php
</Files>

http://domainname.com/articles/whatever will just be parsed (same page) as http://domainname.com/articles.

If you have access to the apache config files, I believe you can use the Location directive to stipulate the virtual root...
http://domainname.com/whatever will just act as if I am accessing http://domainname.com/index.php

I suppose I should point out that you have to have a file called "articles" in the example with the Files directive. Zend Studio can be configured to read a no extension file as a PHP file. Also, you can create an articles.php file (for updating/writing) and then just create a sym link like...
$ ln -s articles.php articles

Also, I dunno what type of Apache server Zend Studio implements. I can't debug in the browser unless I use remote debugging. What are you using?

bpat1434
07-11-2008, 08:04 AM
Also, I dunno what type of Apache server Zend Studio implements.It uses whatever Apache you want (you can install it, or you can have Zend install it).

I honestly don't know. I have a linux box with Apache 2.2.x installed, and have this in my .htaccess and it works perfectly fine (as expected):
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?404 [L]

I'm going to guess you also posted this at Wordpress, as when I searched for things, that came up as well (see: RewriteCond %{REQUEST_FILENAME} (http://wordpress.org/tags/rewritecond-request_filename)).