How to enable .htaccess support for phpstorms builtin webserver
I read, that the builtin webserver of phpstorm supports .htaccess (as apache does).
I defined a .htaccess in the root directory
RewriteEngine on
RewriteRule .html index.php
Calling anything.html should load index.html but I get a 404-Error.I cann´t find a config to switch the .htaccess on.
Any idea what´s going wrong?
Please sign in to leave a comment.
Where did you read that? Link please.
As far as I'm aware it does NOT -- because it is *simple* built in web server.
Thx,
I´m not shure, where I read it.
I presume I missinterpreted it, so if I need .htaccess support I have to use an externan apache, correct?
Correct -- you need Apache for .htaccess.
BTW -- the PHP's own built-in web server (5.4+) supports routing ( http://www.php.net/manual/en/features.commandline.webserver.php -- Example #3), but not .htaccess format.
Hello!
actually some (partial) support is available. But RewriteEngine directive is not supported. Please try using FallbackResource instead.
Also, you would need to install Apache config (.htaccess) support plugin - it's available in Plugins repository
If you need more support (RewriteEngine directive, etc.), please file a feature request to youtrack (http://youtrack.jetbrains.com/issues/WEB). Make sure to attach a test project and describe the expected behavior there
Tnx
<?php
// router.php
if (preg_match('/\.html$/', $_SERVER["REQUEST_URI"]))
{ // how to call index.html and allow it to detect th original request_uri
} else return false;
}
?>
with the script I can detect .html requests but how can I tell the webserver to process index.php
In index.php I want to detect the original request_uri
Have you tried the most obvious
?
Thanks!
<?php
if (preg_match('/\.html$/', $_SERVER["REQUEST_URI"]))
{ include 'index.php';
}
else return false;
?>
works perfect.