Configure PhpStorm to use .htaccess
I added .htaccess
(for rewriting URLs) in my project's root directory but it's not working. I checked twice, the same file is working fine in Eclipse.
How do I configure PhpStorm to use .htaccess?
Do you use the same server/configuration when working with PhpStorm and Eclipse?
As it was explained in the comments, it has nothing to do with the IDE, but with the web server (Apache) and its configuration.
You can edit .htaccess
with any editor, if this virtualhost/directory configuration has AllowOverride All
, ModRewrite is enabled and your rewrite rules are correct, it will work just fine.
You need to ensure that your PHP files are served from the correctly configured web server.
.htaccess
features. Note: it is PHP's, it is NOT PHPStorm's built-in server. But there is a way around.
Most of the time, rewrites are needed only to redirect all the nonstatic file queries to index.php
. If you only need this, you can set the server's "router script" in PHPStorm run configuration to index.php
.
After that, a modest hack in index.php
to serve static files from the drive may speed things up.
Add to the very beginning of index.php
:
if (preg_match('/.(?:php|png|jpg|jpeg|gif|ico|css|js)??.*$/',
$_SERVER["REQUEST_URI"]))
{
return false; // serve the requested resource as-is.
}
链接地址: http://www.djcxy.com/p/17918.html
上一篇: 抓住'阻塞加载混合活动内容'CORS错误