将nginx conf文件转换为apache

时间:2016-02-29 10:07:12

标签: php apache .htaccess mod-rewrite nginx

我试图将配置文件从Nginx移植到Apache。现在我用Nginx运行我的网站,但我想用Apache而不是Nginx。

这里的代码请帮我转换成htaccess,以便我可以在apache上使用它

server
{
    listen 80;
    server_name  domain.mobi www.domain.mobi;
#access_log /var/log/nginx/access.log;
    #error_log /var/log/nginx/default.error.log crit;
    root /home/default/public_html/domain;
    index index.php index.html index.htm;

#server_name www.domain.mobi;
#rewrite ^/(.*)$ http://domain.mobi/$1 permanent;

    # use fastcgi for all php files
    location ~ \.php$
    {
        # secure *.php files
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

rewrite ^/(.*)/page-([0-9]+)$ /?load=$1/page-$2 last;
rewrite ^/newest$ /?load=newest last;
rewrite ^/top-rated$ /?load=top-rated last;
rewrite ^/most-viewed$ /?load=most-viewed last;
rewrite ^/categories$ /?load=categories last;
rewrite ^/dmca$ /?load=dmca last;
rewrite ^/privacy$ /?load=privacy last;
rewrite ^/help$ /?load=help last;
 rewrite ^/(.*).html$ /?load=$1.html last;
rewrite ^/favorites/add-([0-9]+)$ / redirect;
rewrite ^/search/(.*)$ /?load=search/$1 last;
rewrite ^/search$ /search.php last;
rewrite ^/(.*).html/download$ /download.php?file=$1 last;

rewrite ^/keyword$ /?load=keyword last;
rewrite ^/keyword$ /?load=keyword last; 
}

0 个答案:

没有答案