2013-02-06 49 views
6

मैं index.php पेज को छिपाना चाहता हूं और बस डोमेन दिखाऊंगा।.htaccess index.php को रीडायरेक्ट करें/

क्या यह .htaccess के साथ संभव है?

RewriteRule ^index\.php/?$/[L,R=301,NC] 

भी करने की कोशिश की:

RewriteEngine On 
RewriteBase/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/ 
RewriteRule ^index.php$ http://example.com/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 

index.php अभी भी पता चलता

उत्तर

9

प्रयास करें, यह मेरे लिए काम करता है! सुनिश्चित करें कि आपके httpd.conf

RewriteEngine On 

    RewriteCond %{REQUEST_URI} index\.php 
    RewriteRule ^(.*)index\.php$ /$1/ [R=301,L] 

अपने नियमों में एक regex मुद्दा है में AllowOverride All सेट किया हुआ है, मैं अपने नियमों में बदलाव किया है और यह मेरे लिए काम करता है:

RewriteEngine On 
RewriteBase/
RewriteCond %{THE_REQUEST} index\.php 
RewriteRule ^index\.php$ http://example\.com/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index\.php [L] 
+0

नहीं। क्या ब्राउज़र हमेशा index.php दिखा सकते हैं और केवल डोमेन पर रीडायरेक्ट नहीं कर सकते हैं? –

+0

क्या आप अपनी .htaccess फ़ाइल पोस्ट कर सकते हैं। – Satish

+0

ऊपर पोस्ट किया गया है मेरे पास –

3
RewriteRule ^(.*)index\.(html|php)$ http://%{HTTP_HOST}/$1 [R=301,L]