2016-09-19 73 views
1

我有一個簡單的重寫的.htaccess:內部服務器錯誤500和刪除擴展名爲.php衝突

RewriteRule ^knowledge-center/([0-9]+)/(.*)$ knowledge-center-desc.php?id=$1 [QSA,L,NC]

這是給我的錯誤,如

[週一09月19日15:35: 21.351352 2016] [core:error] [pid 61226] [client 103.8.124.146:45569] AH00124:由於可能的配置錯誤,請求超出了10個內部重定向的限制。如果需要,使用'LimitInternalRecursion'來增加限制。使用 'LogLevel的調試',以獲得回溯,引用者:https://thewadhwagroup.com/knowledge-center

然後我取代了代碼與

#Remove .php extensions from php files : 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php 

去除.php擴展

<IfModule mod_rewrite.c> 

    # To externally redirect /dir/foo.php to /dir/foo 
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] 
    RewriteRule^%1 [R,L] 

    # To internally forward /dir/foo to /dir/foo.php 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME}.php -f 
    RewriteRule ^(.*?)/?$ $1.php [L] 

</IfModule> 

然後,我沒有遇到Internal server error ,現在一切正常,但問題是,刪除.php擴展的代碼現在無法正常工作(站點url)。 請給我建議任何解決方案,我的.htaccess什麼是錯的。

更新 - htaccess的代碼

# Leverage Browser Caching 
 

 
<IfModule mod_expires.c> 
 

 
\t ExpiresActive On 
 

 
\t ExpiresByType image/jpg "access plus 1 year" 
 

 
\t ExpiresByType image/jpeg "access plus 1 year" 
 

 
\t ExpiresByType image/gif "access plus 1 year" 
 

 
\t ExpiresByType image/png "access plus 1 year" 
 

 
\t ExpiresByType text/css "access plus 1 month" 
 

 
\t ExpiresByType text/html "access plus 1 month" 
 

 
\t ExpiresByType application/pdf "access plus 1 month" 
 

 
\t ExpiresByType text/x-javascript "access plus 1 month" 
 

 
\t ExpiresByType application/x-shockwave-flash "access plus 1 month" 
 

 
\t ExpiresByType image/x-icon "access plus 1 year" 
 

 
\t ExpiresDefault "access plus 1 month" 
 

 
</IfModule> 
 

 
<IfModule mod_headers.c> 
 

 
\t <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$"> 
 

 
\t \t Header set Cache-Control "max-age=2678400, public" 
 

 
\t </filesmatch> 
 

 
\t <filesmatch "\.(html|htm)$"> 
 

 
\t \t Header set Cache-Control "max-age=7200, private, must-revalidate" 
 

 
\t </filesmatch> 
 

 
\t <filesmatch "\.(pdf)$"> 
 

 
\t \t Header set Cache-Control "max-age=86400, public" 
 

 
\t </filesmatch> 
 

 
\t <filesmatch "\.(js)$"> 
 

 
\t \t Header set Cache-Control "max-age=2678400, private" 
 

 
\t </filesmatch> 
 

 
</IfModule> 
 

 
# mod_rewrite 
 

 
<IfModule mod_rewrite.c> 
 

 
    # Enable mod_rewrite engine 
 

 
    RewriteEngine on 
 

 

 

 
    # WITH 'www.' 
 

 
    #RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [NC] 
 

 
    #RewriteRule ^(.*)$ http://www (link is external).thewadhwagroupprojects.in$1 [L,R=301] 
 

 

 

 
    # WITOUT 'www.' 
 

 

 

 
</IfModule> 
 

 

 

 
<IfModule mod_rewrite.c> 
 
#RewriteEngine On 
 
#RewriteCond %{QUERY_STRING} id=15 
 
#RewriteRule ^(.*)$ https://thewadhwagroup.com/residential-property/15/aquaria-grande? [R=301,L] 
 
</IfModule> 
 

 

 

 

 

 
<IfModule mod_rewrite.c> 
 

 
\t Options -MultiViews 
 
\t RewriteEngine On 
 
\t 
 
\t # To externally redirect /dir/foo.php to /dir/foo 
 
\t RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] 
 
\t RewriteRule^%1 [R=301,NE,L] 
 

 
\t # To internally forward /dir/foo to /dir/foo.php 
 
\t RewriteCond %{REQUEST_FILENAME} !-d 
 
\t RewriteCond %{REQUEST_FILENAME}.php -f 
 
\t RewriteRule ^(.*?)/?$ $1.php [L] 
 

 
</IfModule> 
 

 

 

 
#--- URL FRIENDLY 
 

 
# Options +FollowSymLinks -MultiViews 
 

 

 

 
ErrorDocument 404 https://thewadhwagroup.com/page-not-found 
 

 
ErrorDocument 403 https://thewadhwagroup.com/page-not-found 
 

 

 

 
RewriteEngine On 
 

 
RewriteBase/
 

 

 

 
#redirects old urls 
 

 
#Redirect 301 /about.php \t /about 
 

 
Redirect 301 /corporate-profile.html \t /about 
 

 
#Redirect 301 /knowledge-center.php \t /knowledge-center 
 

 
Redirect 301 /knowledge-center/knowledge-center-loan.html \t /knowledge-center 
 

 
Redirect 301 /knowledge-center/legal.html \t /knowledge-center 
 

 
Redirect 301 /knowledge-center/knowledge-stamp-duty.html \t /knowledge-center 
 

 
Redirect 301 /knowledge-center/knowledge-center-loan.html \t /knowledge-center 
 

 
Redirect 301 /property-care.html \t /knowledge-center 
 

 
Redirect 301 /knowledge-center-right-basics.php \t /knowledge-center-desc.php?id=1 
 

 
Redirect 301 /knowledge-center-taking-loan.php \t /knowledge-center-desc.php?id=2 
 

 
Redirect 301 /knowledge-center-after-loan.php \t /knowledge-center-desc.php?id=5 
 

 
Redirect 301 /blog.php \t /knowledge-center-desc.php?id=6 
 

 
#Redirect 301 /nri-corner.php \t /nri-corner 
 

 
Redirect 301 /knowledge-center/nri-corner.html \t /nri-corner 
 

 
Redirect 301 /nri.html \t /nri-corner 
 

 
#Redirect 301 /career.php \t /career 
 

 
Redirect 301 /hr-corner.html \t /career 
 

 
#Redirect 301 /contact.php \t /contact 
 

 
#Redirect 301 /contact-us.html \t /contact 
 

 
Redirect 301 /site.php#india \t /site.php#india 
 

 
Redirect 301 /contact-us/site-address.html \t /site.php#india 
 

 
Redirect 301 /dubai-office.html \t /site.php 
 

 
Redirect 301 /usa-office.html \t /site.php 
 

 
#Redirect 301 /residential-properties.php \t /residential-properties 
 

 
Redirect 301 /projects.html \t /residential-properties 
 

 
Redirect 301 /residential-ongoing.html \t /residential-properties 
 

 
#Redirect 301 /residential-properties.php?tp=completed \t /residential-properties?tp=completed 
 

 
#Redirect 301 /commercial-properties.php \t /commercial-properties.php 
 

 
#Redirect 301 /commercial-ongoing.html \t /commercial-properties.php 
 

 
Redirect 301 /residential-property-mulund-atmosphere /residential-property/8/atmosphere 
 

 
Redirect 301 /residential-property-matunga-w54 /residential-property/9/w-54 
 

 
Redirect 301 /residential-property-ghatkoper-panorama /residential-property/19/panorama 
 

 
Redirect 301 /residential-property-ghatkoper-panoroma /residential-property/19/panorama 
 

 
Redirect 301 /apartments-in-ghatkopar-mumbai/panorama.html /residential-property/19/panorama 
 

 
#Redirect 301 https://thewadhwagroup.com/residential-property/19/panoroma /residential-property/19/panorama 
 

 
Redirect 301 /residential-property-ghatkoper-promenade /residential-property/20/promenade 
 

 
Redirect 301 /promenade/index.html /residential-property/20/promenade 
 

 
Redirect 301 /residential-property-goregaon-anmolfortune /residential-property/21/anmol-fortune 
 

 
Redirect 301 /anmol-fortune/index.html /residential-property/21/anmol-fortune 
 

 
Redirect 301 /residential-property-bandra-amarjivan /residential-property/11/amarjiwan 
 

 
Redirect 301 /amarjivan/index.html /residential-property/11/amarjiwan 
 

 
#Redirect 301 /residential-property-thane-solitaire.php /residential-property/21/anmol-fortune 
 

 
#Redirect 301 /luxury-properties-in-thane-mumbai/solitaire.html /residential-property/21/anmol-fortune 
 

 
Redirect 301 /residential-property-thane-platina /residential-property/13/platina 
 

 
Redirect 301 /platina-residential/index.html /residential-property/13/platina 
 

 
Redirect 301 /residential-property-thane-evergreen /residential-property/14/evergreen-heights 
 

 
Redirect 301 /apartments-in-thane-mumbai/evergreen-heights.html /residential-property/14/evergreen-heights 
 

 
Redirect 301 /residential-property-thane-courtyard /residential-property/18/wadhwa-courtyard 
 

 
Redirect 301 /residential-property-borivali-aquariagrande /residential-property/15/aquaria-grande 
 

 
Redirect 301 /Aquaria_grande/buy-property-in-mumbai-aquaria-grande.html /residential-property/15/aquaria-grande 
 

 
#Redirect 301 /residential-property-andheri-thenest.php \t/
 

 
#Redirect 301 /the-nest/index.html \t/
 

 
Redirect 301 /residential-property-koregaonpark-marvelbasilo /residential-property/17/marvel-basilo 
 

 
Redirect 301 /marvel-basilo/index.html \t /residential-property/17/marvel-basilo 
 

 
Redirect 301 /residential-property-ghatkoper-theaddress /residential-property/10/the-address 
 

 
Redirect 301 /The_address/Ghatkopar-properties-the-address.html /residential-property/10/the-address 
 

 
Redirect 301 /commercial-property-bkc-thecapital /commercial-property/22/the-capital 
 

 
Redirect 301 /The_Capital/commercial-properties-in-bkc-the-capital.html /commercial-property/22/the-capital 
 

 
Redirect 301 /commercial-property-bkc-platina-comm /commercial-property/24/platina 
 

 
Redirect 301 /Platina/commercial-office-space-in-bkc-Platina.html /commercial-property/24/platina 
 

 
Redirect 301 /commercial-property-andheri-glenmark /commercial-property/26/glenmark 
 

 
Redirect 301 /glenmark/index.html /commercial-property/26/glenmark 
 

 
Redirect 301 /commercial-property-bkc-trade-center /commercial-property/25/trade-center 
 

 

 

 
Redirect 301 /residential-property/51/landmark-prabhadevi http://www.landmarkprabhadevi.com/ 
 

 
Redirect 301 /guides/upcoming-residential-prabhadevi.html http://www.landmarkprabhadevi.com/ 
 

 
Redirect 301 /guides/living-in-prabhadevi.html http://www.landmarkprabhadevi.com/ 
 

 

 

 
Redirect 301 /Solitaier/new-flatsfor-sale-in-mumbai-solitaire.html /residential-property/12/solitaire 
 

 
Redirect 301 /The_address/gallery.html /residential-property/10/the-address 
 

 
Redirect 301 /Imperial_hights/residential-projects-in-mumbai-imperial-heights.html /residential-properties 
 

 
Redirect 301 /Imperial_hights/residential-projects-in-mumbai-imperial-heights.html /residential-properties 
 

 
Redirect 301 /Anmol_prestige/property-for-sale-in-mumbai-anmol-prestige.html /residential-properties 
 

 
Redirect 301 /Anmol_prestige/property-for-sale-in-mumbai-anmol-prestige.html /residential-properties 
 

 
Redirect 301 /Imperial_hights/luxurt-apartments-in-mumbai-imperial-heights.html /residential-properties 
 

 
Redirect 301 /the-nest/gallery.html /residential-property/16/the-nest 
 

 
Redirect 301 /apartments-in-ghatkopar-mumbai/panorama/lifestyle-showcase.html /residential-property/19/panorama 
 

 
Redirect 301 /our_presence.html /about 
 

 
Redirect 301 /res_aquaria_grande.html /residential-property/15/aquaria-grande 
 

 
Redirect 301 /luxury-properties-in-thane-mumbai/solitaire/overview.html /residential-property/12/solitaire 
 

 
Redirect 301 /apartments-in-thane-mumbai/evergreen-heights/overview.html /residential-property/14/evergreen-heights 
 

 
Redirect 301 /residential-property-andheri-thenest /residential-property/16/the-nest 
 

 
Redirect 301 /residential-property-thane-solitaire /residential-property/12/solitaire 
 

 
Redirect 301 /the-nest/index.html /residential-property/16/the-nest 
 

 
Redirect 301 /apartments-in-thane-mumbai/evergreen-heights/overview.html /residential-property/14/evergreen-heights 
 

 
Redirect 301 /commercial-ongoing.html /commercial-properties.php 
 

 
Redirect 301 /luxury-properties-in-thane-mumbai/solitaire.html /residential-property/12/solitaire 
 

 
Redirect 301 /the-nest/index.html /residential-property/16/the-nest 
 

 
Redirect 301 /Imperial_hights/gallery.html/
 

 
Redirect 301 /imperial-pics/gallery/status_4-big.jpg/
 

 
Redirect 301 /imperial-pics/gallery/status_5-big.jpg/
 

 
Redirect 301 /Imperial_hights/gallery.html/
 

 
Redirect 301 /imperial-pics/gallery/status_4-big.jpg/
 

 
Redirect 301 /imperial-pics/gallery/status_5-big.jpg/
 

 
Redirect 301 /res_imperial_heights.html/
 

 
Redirect 301 /res_imperial_heights.html/
 

 
Redirect 301 /res_solitaire.html /residential-property/12/solitaire 
 

 
Redirect 301 /com_the_capital.html /commercial-property/22/the-capital 
 

 
#Redirect 301 /luxury-properties-in-thane-mumbai/solitaire.html /residential-property/12/solitaire 
 

 
Redirect 301 /hospitality.html/
 

 
Redirect 301 /Aquaria_grande/gallery.html /residential-property/15/aquaria-grande 
 

 
Redirect 301 /com_c-66.html /residential-properties 
 

 
Redirect 301 /Anmol_pride/new-properties-in-mumbai-anmol-pride.html /residential-properties 
 

 
Redirect 301 /apartments-in-ghatkopar-mumbai/panorama /residential-property/19/panorama 
 

 
Redirect 301 /res_palm_beach.html /residential-properties 
 

 
Redirect 301 http://www.thewadhwagroup.com/apartments-in-ghatkopar-mumbai/panorama https://thewadhwagroup.com/residential-properties/19/panorama 
 

 

 

 
Redirect 301 /residential-property/8/index /residential-property/8/atmosphere 
 
Redirect 301 /residential-property/8/residential-properties /residential-property/8/atmosphere 
 

 

 
Redirect 301 /index/
 

 
Redirect 301 /residential-property/15/residential-properties /residential-property/15/aquaria-grande 
 
Redirect 301 /residential-property/15/index /residential-property/15/aquaria-grande 
 

 
Redirect 301 /residential-property-desc /residential-properties 
 

 
#vilas .htaccess 
 

 
RewriteRule ^residential-property-new/([0-9]+)/(.*)$ residential-property-desc-new.php?id=$1 [QSA,L,NC] 
 

 
RewriteRule ^commercial-property-new/([0-9]+)/(.*)$ commercial-property-desc-new.php?id=$1 [QSA,L,NC] 
 

 
#RewriteRule ^knowledge-center/([0-9]+)/(.*)$ knowledge-center-desc.php?id=$1 [QSA,L,NC] 
 
RewriteRule ^knowledge-center/(\d+)(?:/.*)?$ knowledge-center-desc.php?id=$1 [QSA,L,NC] 
 

 
#http to https 
 

 
RewriteCond %{HTTPS} off 
 

 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
 

 

 

 
#www to non www 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroup\.com [NC] 
 

 
RewriteRule ^(.*)$ https://thewadhwagroup.com/$1 [L,R=301] 
 

 

 

 
#Remove .php extensions from php files : 
 

 
#RewriteCond %{REQUEST_FILENAME} !-d 
 

 
#RewriteCond %{REQUEST_FILENAME}\.php -f 
 

 
#RewriteRule ^(.*)$ $1.php 
 

 

 

 
#RewriteRule ^knowledge-center/([0-9]+)/(.*)$ knowledge-center-desc.php?id=$1 [QSA,L,NC] 
 

 

 

 
RewriteRule ^residential-property/([0-9]+)/(.*)$ residential-property-desc.php?id=$1 [QSA,L,NC] 
 

 
RewriteRule ^commercial-property/([0-9]+)/(.*)$ commercial-property-desc.php?id=$1 [QSA,L,NC] 
 

 

 

 
#--- END URL FRIENDLY 
 

 

 

 
RewriteEngine on 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^index\.html$ "http\:\/\/thewadhwagroupprojects\.in\/" [R=301,L] 
 

 

 

 
# sunday mobility htaccess to dynamic page 
 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^residential\-property\-matunga\-w54\.php$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-desc\.php?id=9" [R=302,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^corporate\-profile\.html$ "http\:\/\/thewadhwagroupprojects\.in\/about\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^projects\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-properties\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^residential\-ongoing\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-properties\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^commercial\-ongoing\.html$ "http\:\/\/thewadhwagroupprojects\.in\/commercial\-properties\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^nri\.html$ "http\:\/\/thewadhwagroupprojects\.in\/nri\-corner\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^knowledge\-center\/nri\-corner.html$ "http\:\/\/thewadhwagroupprojects\.in\/nri\-corner\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^hr\-corner\.html$ "http\:\/\/thewadhwagroupprojects\.in\/career\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^contact\-us\.html$ "http\:\/\/thewadhwagroupprojects\.in\/contact\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^contact\-us\/site\-address\.html$ "http\:\/\/thewadhwagroupprojects\.in\/site\.php\#india" [R=301,NE,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^dubai\-office\.html$ "http\:\/\/thewadhwagroupprojects\.in\/site\.php\#dubai" [R=301,NE,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^usa\-office\.html$ "http\:\/\/thewadhwagroupprojects\.in\/site\.php\#usa" [R=301,NE,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^press\-media\.html$ "http\:\/\/thewadhwagroupprojects\.in\/press\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^knowledge\-center\/legal\.html$ "http\:\/\/thewadhwagroupprojects\.in\/knowledge\-center\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^knowledge\-center\/knowledge\-stamp\-duty\.html$ "http\:\/\/thewadhwagroupprojects\.in\/knowledge\-center\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^knowledge\-center\/knowledge\-center\-loan\.html$ "http\:\/\/thewadhwagroupprojects\.in\/knowledge\-center\-taking\-loan\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^property\-care\.html$ "http\:\/\/thewadhwagroupprojects\.in\/knowledge\-center\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^apartments\-in\-thane\-mumbai\/evergreen\-heights\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-thane\-evergreen\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^platina\-residential\/index\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-thane\-platina\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^apartments\-in\-ghatkopar\-mumbai\/panorama\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-ghatkoper\-panorama\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^luxury\-properties\-in\-thane\-mumbai\/solitaire\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-thane\-solitaire\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^The_address\/Ghatkopar\-properties\-the\-address\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-ghatkoper\-theaddress\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^the\-nest\/index\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-andheri\-thenest\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^Aquaria_grande\/buy\-property\-in\-mumbai\-aquaria\-grande\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-borivali\-aquariagrande\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^amarjivan\/index\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-bandra\-amarjivan\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^anmol\-fortune\/index\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-goregaon\-anmolfortune\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^promenade\/index\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-ghatkoper\-promenade\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^marvel\-basilo\/index\.html$ "http\:\/\/thewadhwagroupprojects\.in\/residential\-property\-koregaonpark\-marvelbasilo\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^The_Capital\/commercial\-properties\-in\-bkc\-the\-capital\.html$ "http\:\/\/thewadhwagroupprojects\.in\/commercial\-property\-bkc\-thecapital\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^Platina\/commercial\-office\-space\-in\-bkc\-Platina\.html$ "http\:\/\/thewadhwagroupprojects\.in\/commercial\-property\-bkc\-platina\-comm\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^vishwaroop_it_park\/overview\.html$ "http\:\/\/thewadhwagroupprojects\.in\/itpark\-vashi\-vishwaroop\.php" [R=301,L] 
 

 

 

 
RewriteCond %{HTTP_HOST} ^thewadhwagroupprojects\.in$ [OR] 
 

 
RewriteCond %{HTTP_HOST} ^www\.thewadhwagroupprojects\.in$ 
 

 
RewriteRule ^glenmark\/index\.html$ "http\:\/\/thewadhwagroupprojects\.in\/commercial\-property\-andheri\-glenmark\.php" [R=301,L] 
 

 

 

 
# Enable Compression 
 

 
<IfModule mod_deflate.c> 
 

 
    AddOutputFilterByType DEFLATE application/javascript 
 

 
    AddOutputFilterByType DEFLATE application/rss+xml 
 

 
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject 
 

 
    AddOutputFilterByType DEFLATE application/x-font 
 

 
    AddOutputFilterByType DEFLATE application/x-font-opentype 
 

 
    AddOutputFilterByType DEFLATE application/x-font-otf 
 

 
    AddOutputFilterByType DEFLATE application/x-font-truetype 
 

 
    AddOutputFilterByType DEFLATE application/x-font-ttf 
 

 
    AddOutputFilterByType DEFLATE application/x-javascript 
 

 
    AddOutputFilterByType DEFLATE application/xhtml+xml 
 

 
    AddOutputFilterByType DEFLATE application/xml 
 

 
    AddOutputFilterByType DEFLATE font/opentype 
 

 
    AddOutputFilterByType DEFLATE font/otf 
 

 
    AddOutputFilterByType DEFLATE font/ttf 
 

 
    AddOutputFilterByType DEFLATE image/svg+xml 
 

 
    AddOutputFilterByType DEFLATE image/x-icon 
 

 
    AddOutputFilterByType DEFLATE text/css 
 

 
    AddOutputFilterByType DEFLATE text/html 
 

 
    AddOutputFilterByType DEFLATE text/javascript 
 

 
    AddOutputFilterByType DEFLATE text/plain 
 

 
</IfModule> 
 

 
<IfModule mod_gzip.c> 
 

 
    mod_gzip_on Yes 
 

 
    mod_gzip_dechunk Yes 
 

 
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ 
 

 
    mod_gzip_item_include handler ^cgi-script$ 
 

 
    mod_gzip_item_include mime ^text/.* 
 

 
    mod_gzip_item_include mime ^application/x-javascript.* 
 

 
    mod_gzip_item_exclude mime ^image/.* 
 

 
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 
 

 
</IfModule>

回答

1

有這樣說:

Options -MultiViews 
RewriteEngine On 

# To externally redirect /dir/foo.php to /dir/foo 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] 
RewriteRule^%1 [R=301,NE,L] 

RewriteRule ^knowledge-center/(\d+)(?:/.*)?$ knowledge-center-desc.php?id=$1 [QSA,L,NC] 

# To internally forward /dir/foo to /dir/foo.php 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.*?)/?$ $1.php [L] 
+0

我加你的代碼,'中刪除,但現在.php'擴展我在https://thewadhwagroup.com/knowledge-center/1/getting-basics-right發現內部服務器錯誤。請看我編輯的問題。 –

+0

我不理解,請多說明一下 –

+0

在你的htaccess中的所有其他規則之後,用#'向內部轉發/ dir/foo到/ dir/foo.php'向下移動規則。 – anubhava