Following the FAQ and other threads here, I’ve set restful_urls = On and put rewrite rules into my .htaccess. With the latest bleeding-edge OJS, this doesn’t seem to work; the home page loads, but CSS and XHR fail to load, and links to specific journals break as well. (“The requested URL …ojs_dev/index.php/test was not found on this server.”)
Is this a regression, or am I missing some step?
[I did restart Apache, and I get no errors, so it’s not a syntax problem…]
The OJS home page loads, but CSS does not; it is unstyled. Links to register, login, or view specific journals come up 404: visiting a test journal at .../ojs_dev/test gives the message, “The requested URL …/ojs_dev/index.php/test was not found on this server.” Visiting .../ojs_dev/index.php/test directly does work to get to the test journal home page; however, CSS is still not loaded properly.
The Apache error log shows no messages after restart; the access log does show the 404 responses.
It looks like the rewrite rule is being observed, so that /test is redirected to /index.php/test, but for some reason, PHP is not then being properly dispatched to handle that request. When I use a phpinfo() test page and append extra path to that, it shows up properly:
Interesting; if I change the rewrite rule to use test.php instead, which is simply a call to phpinfo(), I get the same behavior: a 404 error that .../ojs_dev/test.php/test is not found. Visiting .../ojs_devtest.php/test directly works. So it’s definitely something with the way Apache is dispatching the request after the rewrite rule fires, rather than a problem with OJS itself. Hrm.
I solved the problem. I think it was due to OJS not running in the server root; e.g., instead of http://example.com/index.php, it was http://example.com/ojs_dev/index.php. Adding a RewriteBase directive fixed it: