URLs and Redirection
Permalink
Once again I've hit the same old problem I always face... URLs and Redirection.
I'm Running 8.4.2.
I add the .htaccess file with code as below:
<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>
I check the box for 'Remove index.php from URLs' and add the domain to Canonical URL field.
This breaks the site with an internal server error.
If I remove the .htaccess file the home page works, but other links show 'not found error'.
Can anyone confirm the exact method that works please?
I'm Running 8.4.2.
I add the .htaccess file with code as below:
<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>
I check the box for 'Remove index.php from URLs' and add the domain to Canonical URL field.
This breaks the site with an internal server error.
If I remove the .htaccess file the home page works, but other links show 'not found error'.
Can anyone confirm the exact method that works please?
Hi madesimplemedia,
Just found out, my server is Apache running on CloudLinux.
Is there a procedure for this type of server please?
Just found out, my server is Apache running on CloudLinux.
Is there a procedure for this type of server please?
hmmm, I'm surprised it doesn't work.
Maybe try:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
Maybe try:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
Thanks for the code change.
It worked for page navigation, however when I tried to delete a page from the sitemap i got an error saying not allowed.
It worked for page navigation, however when I tried to delete a page from the sitemap i got an error saying not allowed.
What did it say "Access Denied"?
Are you logged in as the super user?
If you refresh the page and try again does it work?
Are you logged in as the super user?
If you refresh the page and try again does it work?
here's the weird thing.
with the htaccess code in place but not selected in the CMS under 'Remove index.php from URLs' it works fine. The pages can be found and deleted.
If Remove index.php is ticked it gives the error 'access denied' as shown in attached screen shot.
with the htaccess code in place but not selected in the CMS under 'Remove index.php from URLs' it works fine. The pages can be found and deleted.
If Remove index.php is ticked it gives the error 'access denied' as shown in attached screen shot.
If your server is running mod_security in the back end, try switching it off.
Hi weyboat,
Is it wise to turn off mod security or are you just suggesting to find a fault?
Is it wise to turn off mod security or are you just suggesting to find a fault?
What happens if you remove the domain name fromt he canonical field?
Removing the domain from canonical makes no difference, however i have discovered something more strange.
With the htaccess file and code you gave me in place, but without activating pretty URL's in the CMS, it removed index.php anyhow and I can delete pages too.
With the htaccess file and code you gave me in place, but without activating pretty URL's in the CMS, it removed index.php anyhow and I can delete pages too.
So is everything ok now?
I wanted to experiment on another site before I made any more comments to make sure it wasn't a one-off.
On a different site, I added your code to htaccess and turned on remove index.php from CMS.
Front end of site works fine with index.php removed.
Back end works too, except if i click on the dashboard link top right i get a blank column (shown in attachment) and i can't delete a page (Access Denied Error).
There may be other errors but its not an exhaustive test.
On a different site, I added your code to htaccess and turned on remove index.php from CMS.
Front end of site works fine with index.php removed.
Back end works too, except if i click on the dashboard link top right i get a blank column (shown in attachment) and i can't delete a page (Access Denied Error).
There may be other errors but its not an exhaustive test.
Are you logged in as the super admin? If not, you may not have permissions to delete a page.
Yes I'm super admin on both sites.
Do you have an SSL certificate?
Do you redirect www to non www?
Do you redirect www to non www?
no certificate and not using www at all. Thanks.
so your testing that on a local machine eg localhost?
that's maybe the cause, apache is sometime pretty hard to fine tune, maybe it has nothing to do with c5 but is caused by a wrong config in apache or a missing module
check your /var/log/apache2 it may help
that's maybe the cause, apache is sometime pretty hard to fine tune, maybe it has nothing to do with c5 but is caused by a wrong config in apache or a missing module
check your /var/log/apache2 it may help
Its not a local machine its on the web on my web hosting provider.
not sure what to do with your suggestion about /var/log/apache2 thats above my knowledge.
not sure what to do with your suggestion about /var/log/apache2 thats above my knowledge.
Seems like the default C5 redirect isn't quite right for your server.