httpd.conf and HTML5 pushstate()

落花浮王杯 提交于 2019-11-28 02:01:41
PhearOfRayne

If you're trying to use an index.php file as some type of bootstrap you might want to try this in your .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^(www\.).+$ [NC]
    RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Basically this will redirect all request from non-www to www and then if its not a file or a directory it will forward the request to the index.php file.

I haven’t used pushState() myself, but if the browser is sending a request for /conversations to www.datingjapan.co, then Apache will indeed look for a file or folder called “conversations” in its document root, unless you tell it to do something different.

If you want all URLs on www.datingjapan.co to be handled by one index.php file, then you can use the AliasMatch directive in your Apache settings file:

AliasMatch ^.*$ /index.php

I think this will result in all URLs being handled by index.php. (I’m not very hot on Apache configuration though, so I could be wrong.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!