子目录中的Symfony 4 [英] Symfony 4 in subdirectory

查看:85
本文介绍了子目录中的Symfony 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是法国开发人员,我确实在wamp本地主机的子目录中安装了Symfony 4 .我的项目名为"cardMaker".

I'm a French developer and I did install Symfony 4 on a subdirectory of my wamp localhost. My project is named "cardMaker".

我有一个.htaccess文件,可重定向到公共目录(index.php):

I've a .htaccess file to redirect towards the public directory (index.php) :

<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteRule "^$" public/ [L]

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

那行得通.但是,当我打开http://localhost/cardMaker/时,我得到了:

That works. But, when I open http://localhost/cardMaker/, I have this:

如何设置基本网址?

感谢您的回复, 狮身人面像

Thank's for your responses, Sphinx

推荐答案

添加symfony应用作为别名.配置您的apache httpd.conf文件:

Add the symfony app as an alias. Configure your apache httpd.conf file:

Alias /cardMaker "C:/Csi\CsiWorkspace/cardMaker/public"
<Directory "C:/Csi\CsiWorkspace/cardMaker/public">
    AllowOverride All
    Options Indexes FollowSymLinks
    Require all granted

    DirectoryIndex index.php index.html

  <IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteRule cache/ - [F]
    RewriteBase /symfonytest

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

</Directory>

注意将 RewriteBase 用作别名 cardMaker

这篇关于子目录中的Symfony 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆