我已经尝试在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>
LoadModule rewrite_module modules / 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>
在.htaccess
目录中使用以下/msk
:
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>
并在.htaccess
目录中使用此/msk/web
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</IfModule>