Htaccess apache永久链接404(他们不再工作了)

时间:2017-10-28 17:02:43

标签: apache .htaccess mod-rewrite nginx

我们将网站从nginx切换到普通的apache网络服务器,但现在我们对固定链接有一个大问题:全部丢弃404.(在一切运行良好之前) 我试图配置htaccess文件正确但我坚持下去。 链接结构,我仍然可以访问该网站: http://abc.de/subdomain/foobar/index.php?page=PageOne 链接结构应该如何: http://abc.de/subdomain/foobar/PageOne

我当前的htaccess文件:

DocumentRoot "/home/johnedoe/public_html/subdomain/"

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /foobar/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt|svg)$ [NC]
RewriteRule ^(.*)/$ index\.php\?page=$1 [NC,R=301,L]
</IfModule>

当然我也为.htaccess激活了错误日志:

&#13;
&#13;
[root@host apache]# cat error_log
18:21:53.998 [INFO] [APVH_abc.de_Suphp56:] PID: 182662, add child process pid: 188198, procinfo: 0x2e29eb0
18:21:55.304 [INFO] [123.123.123:123:9122] File not found [abc.de/subdomain/foobar/PageOnebower_components/font-awesome/fonts/fontawesome-webfont.woff2]
18:21:55.304 [INFO] [123.123.123:123:9122] File not found [abc.de/subdomain/foobar/PageOne404.shtml]
18:21:55.312 [INFO] [123.123.123:123:9089] File not found [abc.de/subdomain/foobar/PageOneassets/fonts/SairaSemiCondensed-Regular.eot]
18:21:55.312 [INFO] [123.123.123:123:9089] File not found [abc.de/subdomain/foobar/PageOne404.shtml]
18:21:55.317 [INFO] [123.123.123:123:9104] File not found [abc.de/subdomain/foobar/PageOne404.shtml]
....
18:21:55.557 [INFO] [123.123.123:123:9106] [REWRITE] strip base: '/johndoe/' from URI: '/johndoe/website/assets/fonts/fontawesome-webfont.woff'
18:21:55.557 [INFO] [123.123.123:123:9106] [REWRITE] Rule: Match 'website/assets/fonts/fontawesome-webfont.woff' with pattern '^(.*)/$', result: -1
18:21:55.581 [INFO] [123.123.123:123:9104-3#APVHjohndoe.abc.de] File not found [abc.de/subdomain/foobar/PageOneassets/fonts/SairaSemiCondensed-Regular.ttf]
18:21:55.581 [INFO] [123.123.123:123:9104-3#APVHjohndoe.abc.de] File not found [abc.de/subdomain/foobar/PageOne404.shtml]
18:21:55.594 [INFO] [123.123.123:123:9106-1#APVH_abc.de] [REWRITE] strip base: '/johndoe/' from URI: '/johndoe/website/assets/fonts/fontawesome-webfont.woff'
18:21:55.594 [INFO] [123.123.123:123:9106-1#APVH_abc.de] [REWRITE] Rule: Match 'website/assets/fonts/fontawesome-webfont.woff' with pattern '^(.*)/$', result: -1
18:21:55.892 [INFO] [123.123.123:123:9076] [REWRITE] strip base: '/johndoe/' from URI: '/johndoe/website/assets/images/favicon/favicon-32x32.png'
18:21:55.893 [INFO] [123.123.123:123:9076] [REWRITE] Rule: Match 'website/assets/images/favicon/favicon-32x32.png' with pattern '^(.*)/$', result: -1
18:21:55.926 [INFO] [123.123.123:123:9076-1#APVH_abc.de] [REWRITE] strip base: '/johndoe/' from URI: '/johndoe/website/assets/images/favicon/favicon-16x16.png'
18:21:55.926 [INFO] [123.123.123:123:9076-1#APVH_abc.de] [REWRITE] Rule: Match 'website/assets/images/favicon/favicon-16x16.png' with pattern '^(.*)/$', result: -1
...
18:22:22.913 [INFO] [123.123.123:123:9095] File not found [/home/abc.de/public_html/website/index.php]
18:22:22.913 [INFO] [123.123.123:123:9095] File not found [/home/abc.de/public_html/404.shtml]
&#13;
&#13;
&#13;

最后但并非最不重要的是我在nginx中找到的旧重写规则:

location / {
        try_files $uri $uri/ /index.php?$uri&$args;
    }

有没有人有想法?非常重要 - 谢谢!!

0 个答案:

没有答案