Title: Remove index.php with nginx?
Last modified: May 9, 2020

---

# Remove index.php with nginx?

 *  [kosmos22](https://wordpress.org/support/users/kosmos22/)
 * (@kosmos22)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/remove-index-php-with-nginx/)
 * Hello,
    when i open site.com/somedir it will return me automatic to index.php
 * How can i remove index.php from url? I mean i want to return 404 when dir is 
   not exist.
 * My rules right now is;
 * location / {
    try_files $uri $uri/ /index.php?$args; }

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [Yui](https://wordpress.org/support/users/fierevere/)
 * (@fierevere)
 * 永子
 * [6 years, 1 month ago](https://wordpress.org/support/topic/remove-index-php-with-nginx/#post-12805991)
 * this is fine and will behave like you want (return 404 when directory is not 
   exists)
    (actually returned by WordPress)
 *  Thread Starter [kosmos22](https://wordpress.org/support/users/kosmos22/)
 * (@kosmos22)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/remove-index-php-with-nginx/#post-12806002)
 * This is that I want to return 404 by default to nginx and not via wordpress.
   
   How can this happen?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Remove index.php with nginx?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [kosmos22](https://wordpress.org/support/users/kosmos22/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/remove-index-php-with-nginx/#post-12806002)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
