htaccess/url rewrite with Silex, XAMPP, and multifolder stru



我已经尝试在 XAMPP 上为 Silex 应用程序正确设置 url 重写时搜索多个以前的线程,但仍然无法解决这个问题。这就是我正在努力实现的目标。

我正在使用XAMPP,这是我的htdocs文件夹的结构:

    - xampp 
        - htdocs
            - app1
            - app2
            - app3 <silex application>
                .htaccess file (outside of web folder)
                - web
                    index.php file

我目前可以做 http://localhost:50000/msk/web/cte。我的问题是我如何摆脱"网络"(即 http://localhost:50000/msk/cte(

我觉得我错过了一些小东西,但我无法弄清楚。

    <IfModule mod_rewrite.c>
       Options -MultiViews
       RewriteEngine On
       RewriteBase /msk/web/
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^ index.php [QSA,L]
    </IfModule>

加载模块rewrite_module模块/mod_rewrite.so 在我的配置中没有注释。我也没有使用虚拟主机。

谢谢

试试这个

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

你可以试试:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /msk/web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^cte/url-word$ cte/redirect-page [L]
</IfModule>

/msk目录中使用以下.htaccess

Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(web)
# ------- browser looks for them on base url -------- ex: /images/logo.png
RewriteRule ^css/(.*)$ web/css/$1 [L]
RewriteRule ^js/(.*)$ web/js/$1 [L]
RewriteRule ^images/(.*)$ web/images/$1 [L]
RewriteRule (.*) /web/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php
</IfModule>

并在/msk/web目录中使用此.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</IfModule>

最新更新