Concrete5 pretty URL’s (mod_rewrite) stopped working

I manage two websites, both running the Concrete5 CMS (v5.6.3.4) which uses an .htaccess file to rewrite the URL’s so the ‘index.php’ file is hidden and the URL’s look a lot better. Similar to what WordPress does. The .htaccess content added by Concrete5 is:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>

Read More

This used to work fine, but now only the homepage is reachable. When I visit one of the webpages like /contact a HTTP 301 Moved Permanently is returned and I’m redirected to the homepage.

When I visit /index.php/contact the contact page loads correctly.
I also tried the WordPress rewrite rules and that gave the same result.

It looks like it stopped working because of some Apache, PHP or mod_rewrite module version change or something by my hosting company.
The sites run on Apache 2.4.17 and PHP 5.5.30. I can’t discover the mod_rewrite module version.

I also tried the Apache FallbackResource /index.php and that seemed to work for the sub pages, but in that case the homepage failed loading.

Any help is appreciated.

Update:

The Apache loaded modules are:

core mod_authn_file mod_authn_dbm mod_authn_anon mod_authn_dbd mod_authn_socache mod_authn_core mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_dbm mod_authz_owner mod_authz_dbd mod_authz_core mod_access_compat mod_auth_basic mod_auth_form mod_auth_digest mod_allowmethods mod_file_cache mod_cache mod_cache_disk mod_cache_socache mod_socache_shmcb mod_socache_dbm mod_socache_memcache mod_so mod_macro mod_dbd mod_dumpio mod_buffer mod_ratelimit mod_reqtimeout mod_ext_filter mod_request mod_include mod_filter mod_substitute mod_sed mod_deflate http_core mod_mime mod_log_config mod_log_debug mod_logio mod_env mod_expires mod_headers mod_unique_id mod_setenvif mod_version mod_remoteip mod_proxy mod_proxy_connect mod_proxy_ftp mod_proxy_http mod_proxy_fcgi mod_proxy_scgi mod_proxy_wstunnel mod_proxy_ajp mod_proxy_balancer mod_proxy_express mod_session mod_session_cookie mod_session_dbd mod_slotmem_shm mod_ssl mod_lbmethod_byrequests mod_lbmethod_bytraffic mod_lbmethod_bybusyness mod_lbmethod_heartbeat mod_unixd mod_dav mod_status mod_autoindex mod_info mod_suexec mod_cgi mod_dav_fs mod_dav_lock mod_vhost_alias mod_negotiation mod_dir mod_actions mod_speling mod_userdir mod_alias mod_rewrite mod_php5 mod_ruid2 prefork

Related posts

3 comments

  1. I run a similar apache / php version and the only difference I can see is this:

    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    

    Note the / in front of index.php. Try that, then add in the two extra conditions in yours, and see if it works.

    Note, this is in .htaccess and in my actual virtual hosts file in apache.

    Are you sure mod rewrite is enabled? Try a simple rule as a test:

    RewriteRule ^xxx https://google.com [R=301,L]
    

    before the rewrite block you have, save, restart apache (if it’s not .htaccess), then try accessing: yoursite.com/xxx

    If it works, and you end up on google, then rewrite is fine.

    Also check phpinfo() if you haven’t, you should see this, or something like it:

    Configuration
    apache2handler
    
    Loaded Modules  core mod_so http_core [...] mod_alias mod_rewrite [...]
    

    By the way, your provided data was excellent.

    As far as I know, Apache and its modules ship together, at least the standard ones, though I could be wrong, but I believe most installations would be like that, so it’s at least highly unlikely that there would be an issue there, but what is highly likely is that the hosting company may have forgotten to turn on mod rewrite, I’ve seen that several times here with similar questions.

    UPDATED:

    I tested your urls with firefox live http headers:

    GET /aanleg/ HTTP/1.1
    HTTP/1.1 301 Moved Permanently
    Location: http://yoursite.com
    

    I first wrote your redirect is working fine, but it’s not working fine, it’s totally wrong, because there should be no redirect.

    Since you ran phpinfo, php is also running.

    You’ll need to show your entire htaccess becuase you have a bad rule that is redirecting the url.

    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www.yoursite.nl [NC]
    RewriteRule ^(.*)$ http://www.yoursite.nl/$1 [R=301,L]
    
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    

    This is all you should have for rewrites unless you have specific ones, but there’s clearly a rewrite rule that is sending everything to / which should NOT be happening.

    UPDATE: this issue was determined almost certainly to be a concrete5 problem, not an apache redirect issue.

Comments are closed.