htaccess file
-
Hi,
My wordpress website automatically generates a /index.php file which are currently 302 redirected to its equivalent non /index.php (E.g contact-us/index.php to /contact-us/ which is my preferred version) I want to get rid of this /index.php file and 301 permanent redirect them to its equivalent.
How can I do this in my .htaccess file? This is my current .htaccess file.
# BEGIN WordPress " <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
I was thinking to change that to this:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} \/index.php\ HTTP [NC] RewriteRule (.*)index.php$ /$1 [R=301,L] RewriteRule . /index.php [L] </IfModule> # END WordPress
Will this work?
Please let me know. Feedback is highly appreciated.
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘htaccess file’ is closed to new replies.