我一直沒有任何結果搜索諸如3或4小時(搜索我之前打了規則了一個小時,但不能這樣做)從URL中移除的symfony www和index.php文件
我不'不知道你是否注意到或沒有,但谷歌使用這樣的www
當它沒有子域時,它將是www.google.com/blabla和 當有子域它會earth.google.com/blabla
這是第一部分
第二部分,正如你在symfony網站上所知道的,就像domain.com/index.php/test一樣,感謝symfony .htaccess文件,你可以通過domain.com/test來訪問它 所以這裏是我努力嘗試的實現
domain.com/test重定向到www.domain.com/test
www.sub.domain.com/blabla重定向到sub.domain.com/blabla
www.sub.domain .com /重定向到sub.domain.com(沒有任何index.php XD)
其中一個令人討厭的問題是從domain.com/重定向到www.domain.com是t重新定向後它是像www.domain.com/index.php(我討厭index.php:P)
那麼有一種方式,一個重定向解決這個問題? 我敢肯定,我不是誰需要這樣的事情,可能是其他人的想法誰是要擁有自己的網站用symfony或其他框架 感謝
這裏是我的完整htaccess文件
只有一個Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# The admin subdomain returns to the backend
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^admin\.mydomain\..*
RewriteRule ^(.*)$ backend.php [QSA,L]
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase/
RewriteCond %{HTTP_HOST} !^www.mydomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301]
# we skip all files with .something
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
你有 no_script_name:在你的settings.yml中的督促下,部分真實 和: 重寫規則^ $的index.php [QSA,L] htaccess的(*)? – Jestep