2017-04-14 56 views
0

Si我有2個Apache重寫,似乎獨立工作,但不能彼此聯合。一個HTTP流量重定向到HTTPS和其他附加.PHP的請求沒有擴展名,但它有麻煩在同一時間做兩,結束了404Apache重寫不與.htaccess正確鏈接

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.+)$ $1.php 

RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} projects 
RewriteRule ^(.*)$ https://www.example.com/projects/$1 

回答

0

使用它像這樣,

RewriteEngine On 

RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} ^projects 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [L] 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.+)$ $1.php [L] 
+0

沒有運氣,並且第一條重寫規則丟失了/ – David

+0

錯誤是什麼?它在這裏工作。 –

+0

這是彈跳到404。 – David