最近一直在做孕媽團的項目,因為部署到實際項目中出現了鏈接打不開的情況,要默認添加index.php才能正常訪問。
當時忘了是Tinkphp的URL重寫模式:以后遇到相同問題,首先要想到URL重寫模式。
- httpd.conf配置文件中加載了mod_rewrite.so模塊
- AllowOverride None 將None改為 All
- 把下面的內容保存為.htaccess文件放到應用入口文件的同級目錄下
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond $1 !^(DATA|images|otherThings)
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
</IfModule>