Title: mod_rewrite causing 404 on index.php
Last modified: August 18, 2016

---

# mod_rewrite causing 404 on index.php

 *  Resolved [rlueder](https://wordpress.org/support/users/rlueder/)
 * (@rlueder)
 * [19 years ago](https://wordpress.org/support/topic/mod_rewrite-causing-404-on-indexphp/)
 * Hello,
 * I´m having a hard time getting WordPress to work with mod_rewrite, I´ll try to
   explain the situation…
 * I have this domain ([http://pontomidia.com.br/](http://pontomidia.com.br/)) which
   I share with 3 other friends, each of us has a directory with our names (e.g.
   [http://pontomidia.com.br/rafael/](http://pontomidia.com.br/rafael/)) where we
   run our portfolios, blogs, etc.
 * I´ve recently acquired a new domain name ([http://rafael-lueder.com/](http://rafael-lueder.com/))
   which redirects to our existing domain. I´m using a php redirect to take my new
   domain directly to my directory and I´m also using mod_rewrite to hide the directory
   name in the address bar of browsers, so that
 * [http://rafael-lueder.com/rafael/blog/](http://rafael-lueder.com/rafael/blog/)(
   which looks redundant)
 * in the address bar will appear as
 * [http://rafael-lueder.com/blog/](http://rafael-lueder.com/blog/)
 * And here´s my problem. While the administration interface of WordPress and the
   blog itself are accessible I keep getting a 404 for /blog/index.php when trying
   to click a permalink, comments, categories or the about page links (you can see
   it here [http://rafael-lueder.com/blog/](http://rafael-lueder.com/blog/)). I´
   ve tried changing “WordPress address” and “Blog address” under “Options – General”
   but had no success.
 * Any ideas of how I can fix this? Thanks.

Viewing 1 replies (of 1 total)

 *  Thread Starter [rlueder](https://wordpress.org/support/users/rlueder/)
 * (@rlueder)
 * [19 years ago](https://wordpress.org/support/topic/mod_rewrite-causing-404-on-indexphp/#post-561616)
 * Well, after many trials and errors it’s now solved.
 * Below my .htaccess files, the first one in the root of my domain the second one
   in wordpress directory.
 * I also had to set “WordPress address” and “Blog address” under “Options – General”
   to [http://rafael-lueder.com/blog](http://rafael-lueder.com/blog)
 * I had a lot of help from richardk at [http://forum.modrewrite.com/](http://forum.modrewrite.com/)
 * <IfModule mod_rewrite.c>
    RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.)?
   rafael-lueder\.com$ [NC] RewriteCond %{DOCUMENT_ROOT}/rafael%{REQUEST_URI}/ -
   d RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L] RewriteCond %{ENV:REDIRECT_STATUS}
   ^$ RewriteCond %{HTTP_HOST} ^(www\.)?rafael-lueder\.com$ [NC] RewriteRule ^(.*)
   $ /rafael/$1 [QSA,L] </IfModule>
 * <IfModule mod_rewrite.c>
    RewriteEngine on RewriteBase /rafael/blog/ RewriteCond%{
   REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /rafael/
   blog/index.php [L] </IfModule>

Viewing 1 replies (of 1 total)

The topic ‘mod_rewrite causing 404 on index.php’ is closed to new replies.

## Tags

 * [index.php](https://wordpress.org/support/topic-tag/index-php/)
 * [mod_rewrite](https://wordpress.org/support/topic-tag/mod_rewrite/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [rlueder](https://wordpress.org/support/users/rlueder/)
 * Last activity: [19 years ago](https://wordpress.org/support/topic/mod_rewrite-causing-404-on-indexphp/#post-561616)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
