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?

0
I read, that the builtin webserver of phpstorm supports .htaccess (as apache does).

Where did you read that? Link please.

As far as I'm aware it does NOT -- because it is *simple* built in web server.

0
Avatar
Permanently deleted user

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?

0

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.

0

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

0
Avatar
Permanently deleted user

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

0
with the script I can detect .html requests but how can I tell the webserver to process index.php

Have you tried the most obvious

include "index.php";

?

0
Avatar
Permanently deleted user

Thanks!

<?php
if (preg_match('/\.html$/', $_SERVER["REQUEST_URI"]))
{ include 'index.php';
}
else return false;
?>

works perfect.

0

请先登录再写评论。