Nginx and Wordpress htaccess url conversion

Evan Miller emmiller+gmane at gmail.com
Wed May 9 06:35:14 MSD 2007


Steve <steven.romej at ...> writes:
> 
> Here's my current mess.  I'm trying to run the PHP-based blog off the /blog/
> directory.  The / directory will contain a Rails app.  Not sure if I'm going
> about that correctly either.
> 
> location /blog/ {
>    root html/rankforest.com;
>    index index.php;
> 
>    #if ( !-e $request_filename ) {
>    #  rewrite ^/blog(.*)[^/]$ /blog$1/ break;
>    #}
> 
>   if ( !-e $request_filename ) {
>        rewrite ^([0-9a-zA-Z]+)?(/wp-.*) $2 break;
>        rewrite ^([0-9a-zA-Z]+)?(/.*\.php)$ $2 last;
>        rewrite ^ /blog/index.php last;
>   }
> 
>   #if ( !-e $request_filename ) {
>   #  rewrite ^/blog/(.*)$ /blog/index.php/$1 break;
>   #}
>  }

Yikes! Perhaps the error_page directive will come in handy... try:

    location /blog/ {
        root html/rankforest.com;
        index index.php;

        error_page 404 /blog/index.php$request_uri;
    }

Not 100% sure, but I think that'll work.

Evan

> 
> Thank you for your help!
> 
> 









More information about the nginx mailing list