Can't seem to enable 'pretty URL's' without the site going into error.

Permalink
When I try and enable pretty url's .. I get this message...

"It was not possible to detect your server kind. Here's the configuration sections for every supported server: please manually remove the one relevant for you from your server configuration.

>>> For Apache <<<
<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>

>>> For nginx <<<
location / {
try_files $uri $uri/ /index.php?$query_string;
}

.. and then the site partially goes down. The homepage appears to be ok but I get 404 errors if I try and click on any other page on the site.

When I 'un-tick' the "Remove index.php from URLs" box.. everything goes back to normal.

However, I really do want to remove index.php from my url's.

I'm not understanding where I will find my server configuration file and what exactly I need to remove.

PS. I've just upgraded to C5 8.4.3.

Any help would be greatly appreciated. :)

brisseo
 
brisseo replied on at Permalink Reply
brisseo
I finally managed to sort it out myself.

If the site goes into error when you try to enable "Pretty URL's" in order to remove "index.php" from the end of the url - It means there is no .htaccess file.

Here's How I fixed it:

Go to cPanel – File Manager – Site – +Add File - .htaccess - Edit file – insert following code:

<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>


Save

And this should completely fix the problem. It did for me.

PS. If the .htaccess file does exist then place the code above everything else.

Hope that helps someone :)