2014-11-03 139 views
1

我想轉發麻煩與的.htaccess

https://pinpoll.net/plugin/getPoll?category_id=27 

https://pinpoll.com/plugin/getPoll?category_id=27 

此外,任何非安全http:// 。 。 *應該被轉發到https://*pinpoll.com例如,

http://pinpoll.net/Bloghttps://pinpoll.com/Blog

http://pinpoll.comhttps://pinpoll.com

規則應該影響任何的子域像https://dev.pinpoll.com但工作http://www.pinpoll.net被轉發給https://pinpoll.net

這是我的.htaccess看起來像此刻:

RewriteEngine on 

RewriteRule ^(.*)\.[\d]{10}\.(css|js)$ $1.$2 [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)\?*$ index.php [QSA] 

RewriteCond %{HTTP_HOST} ^(.*)pinpoll\.de [NC] 
RewriteRule ^(.*)$ https://pinpoll.com/$1 [R=permanent,L] 
RewriteCond %{HTTP_HOST} ^(.*)pinpoll\.at [NC] 
RewriteRule ^(.*)$ https://pinpoll.com/$1 [R=permanent,L] 
RewriteCond %{HTTP_HOST} ^(.*)pinpoll\.us [NC] 
RewriteRule ^(.*)$ https://pinpoll.com/$1 [R=permanent,L] 
RewriteCond %{HTTP_HOST} ^(.*)pinpoll\.co.uk [NC] 
RewriteRule ^(.*)$ https://pinpoll.com/$1 [R=permanent,L] 
RewriteCond %{HTTP_HOST} ^(.*)pinpoll\.net [NC] 
RewriteRule ^(.*)$ https://pinpoll.com/$1 [R=permanent,L] 

RewriteCond %{HTTPS} !on 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,QSA] 

</IfModule> 

<IfModule !mod_rewrite.c> 
ErrorDocument 404 index.php 
</IfModule> 

<ifModule mod_expires.c> 

    ExpiresActive On 
    ExpiresDefault "access plus 10 days" 

    <FilesMatch "\.(gif|jpe?g|png)$"> 
     ExpiresDefault "access plus 20 days" 
     Header set Cache-Control "public" 
    </FilesMatch> 

    <FilesMatch "\.(js)$"> 
     ExpiresDefault "access plus 5 days" 
     Header set Cache-Control "public" 
    </FilesMatch> 

    <FilesMatch "\.(php)$"> 
     Header set Cache-Control "private" 
    </FilesMatch> 

</ifModule> 

<IFModule mod_deflate.c> 
    <filesmatch "\.(js|css|html|jpg|jpeg|png|gif)$"> 
     SetOutputFilter DEFLATE 
    </filesmatch> 
</IFModule> 

<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak|cache)$"> 
    Order Allow,Deny 
    Deny from all 
</FilesMatch> 

例URL

http://pinpoll.net/plugin/getPoll?category_id=27 

將成爲

https://pinpoll.com/index.php/getPoll?category_id=27 

...這是我想要什麼差不多,但我正在失去/插件/正在被替換爲/index.php/。後者應該只有如果既不文件(!-f),也不文件夾(!-d)存在,這是不爲所希望的輸出是

https://pinpoll.com/plugin/getPoll?category_id=27 

任何幫助的情況下/提示的高度讚賞的情況下!

乾杯,托比亞斯

回答

0

你需要重新安排你的規則,並把這樣的規則:

RewriteCond %{HTTPS} !on 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] 

略低於RewriteEngine On線和測試新的瀏覽器。

也將低於其它HTTPS此規則重定向:

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

讓我們[繼續聊天討論](http://chat.stackoverflow.com/rooms/64243/discussion-between-anubhava-and -tobias)。 – anubhava 2014-11-04 13:57:46

+1

非常感謝,anubhava! – Tobias 2014-11-04 14:12:54