Title: htaccess file
Last modified: August 30, 2016

---

# htaccess file

 *  [WordPress Apprentice](https://wordpress.org/support/users/wordpress-apprentice/)
 * (@wordpress-apprentice)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/htaccess-file-33/)
 * 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)

 *  Thread Starter [WordPress Apprentice](https://wordpress.org/support/users/wordpress-apprentice/)
 * (@wordpress-apprentice)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/htaccess-file-33/#post-6476651)
 * I actually tried it, but it didn’t work? Any help would be very greatfull

Viewing 1 replies (of 1 total)

The topic ‘htaccess file’ is closed to new replies.

## Tags

 * [.htaccess-file](https://wordpress.org/support/topic-tag/htaccess-file/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [WordPress Apprentice](https://wordpress.org/support/users/wordpress-apprentice/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/htaccess-file-33/#post-6476651)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
