简体   繁体   中英

How to use .htaccess file from PhpStorm?

I have created a .htaccess file in the root folder of my project. I am using PhpStorm and it has a default server I think. .htaccess is not working from the PhpStorm server. But when i placed my project in htdocs folder of XAMPP, it works perfectly. But from the PhpStorm, it can not run.

How can I fix this? I want to redirect anything like: domain.com/<any string except php file> to my index.php file.

PhpStorm has a Built-In Web Server for static assets:

The built in server can only serve static content like HTML, JavaScript and CSS.

You can also configure a PHP interpreter and use the PHP Built-In Web Server :

When the interpreter is configured, PhpStorm will automatically start the PHP Built-In Web Server and redirect all PHP requests to it as soon as you run your PHP application.

None of these two pieces of software have anything to do with Apache HTTP Server , nor will they use its settings.

These facilities are only intended to provide a quick way to test web sites without the need of installing additional software. Since you already have additional software, there's really no benefit.

Source Link

Associate a name pattern with the distributed configuration file type

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), and select Editor | File Types.

  2. Select Apache config files from the Recognized File Types list.

  3. In the Registered Patterns area, click icons general add +.

  4. In the Add wildcard dialog box that opens, specify the pattern that defines the extensions of your distributed configuration files.

  5. Click OK. PhpStorm returns you to the File Types page where the specified pattern is added to the Registered Patterns list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM