Vilas Galave Vilas Galave - 2 months ago 9
PHP Question

.htaccess : Internal server error 500 and removing .php extension conflict

I have a simple rewrite

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


which was giving me error like


[Mon Sep 19 15:35:21.351352 2016] [core:error] [pid 61226] [client 103.8.124.146:45569] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer:
https://thewadhwagroup.com/knowledge-center



Then I replaced the code for removing
.php
extension

<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>


with

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


And then I not faced
Internal server error
, everything now working fine but the problem is that, the code for removing
.php
extension is not working now (site url).
Please suggest me any solution that whats going wrong in my
.htaccess
.

Update - htaccess code



# Leverage Browser Caching

<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/jpg "access plus 1 year"

ExpiresByType image/jpeg "access plus 1 year"

ExpiresByType image/gif "access plus 1 year"

ExpiresByType image/png "access plus 1 year"

ExpiresByType text/css "access plus 1 month"

ExpiresByType text/html "access plus 1 month"

ExpiresByType application/pdf "access plus 1 month"

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

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

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

ExpiresDefault "access plus 1 month"

</IfModule>

<IfModule mod_headers.c>

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

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

</filesmatch>

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

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

</filesmatch>

<filesmatch "\.(pdf)$">

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

</filesmatch>

<filesmatch "\.(js)$">

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

</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>

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]

# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
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 /about

Redirect 301 /corporate-profile.html /about

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

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

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

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

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

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

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

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

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

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

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

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

Redirect 301 /nri.html /nri-corner

#Redirect 301 /career.php /career

Redirect 301 /hr-corner.html /career

#Redirect 301 /contact.php /contact

#Redirect 301 /contact-us.html /contact

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

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

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

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

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

Redirect 301 /projects.html /residential-properties

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

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

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

#Redirect 301 /commercial-ongoing.html /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 /

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

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

Redirect 301 /marvel-basilo/index.html /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>




Answer

Have it this way:

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]
Comments