Pretty URL/Mod-rewrite not working with GoDaddy

Permalink
http://www.arizonaluxurycoach.com

I have a new client site built in 8.4.2 that we are attempting to launch but can't get URL Redirects to work either with the various config file methods through the C5 dashboard or with htaccess. I get a 404 error on all internal pages when enabled through the dashboard. I get no change or rewriting at all when done purely through the htaccess file. I have tried every combination of just the config files (renders 404 error on internal pages), just an htaccess file (no change, still has index.php in the URL), and both combined with all 3 variations below in the htaccess file (404 error on internal pages):

Suggested by C5:
<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>


Suggested by GoDaddy:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>


Another Variation that doesn't work:
<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule .* index.php [L]
</IfModule>

barkingtuna
 
barkingtuna replied on at Permalink Reply
barkingtuna
PHP version was set to 7.2. I have other sites hosted on Hostmonster and Bluehost with PHP 5.6 so I modified the GoDaddy settings to PHP 5.6 and still no change.
barkingtuna replied on at Permalink Reply
barkingtuna
SOLVED: Interestingly... I recall someone saying a while back to add a BLANK php5.ini file to the root in conjunction with htacess. I did that in tandom with the htacces file and enabled URL Redirection via the dashboard on top of the php5.ini and htaccess combo and it worked...

<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>
sbattaglia replied on at Permalink Reply
Thanks for the post.

Every Azure site I've done pretty urls are no issue with SSL/https. GoDaddy is another story. So I am running php 7.2 and tried adding a blank php7.ini file to my site root, and used the redirects you mention here.

In C5, I checked the box for pretty urls, my canonical url is set to the https url. Checked the box for ony render at canonical. Cleared cache in C5. But only the home page will load without 404 unless I remove pretty urls.

Any other suggestions?

Much appreciated.
barkingtuna replied on at Permalink Reply
barkingtuna
I actually switched to PHP 5.6, used the code above in the htaccess file, created a blank php5.ini file and it worked. I've since updated back to PHP 7.2 and left the php5.ini file in place and the rewriting has continued to work. Try changing the PHP version to 5.6 and let me know if that works.
sbattaglia replied on at Permalink Reply
Thanks! I will give that a try after business hours today when the site has fewer visitors. I think that is the minimum php version Concrete5 v 8.3.2 will work with, so fingers crossed.
sbattaglia replied on at Permalink Reply
So the setup I'm working with is a GoDaddy managed server running centos. Server is managed by WHM/cPanel.

The issue (in my case) was this:
As GoDaddy will not allow you to edit the httpd.conf file, I used the terminal in WHM to vi the file. Noticed that the VirtualHost tag for :80 had a
<Directory "my/document/root/directory">
AllowOverride All
</Directory>
inside the VirtualHost tag whereas the VirtualHost tag for :443 did not.

This explains why pretty urls worked before installing ssl :)

After installing the SSL cert, any of my redirects for pretty URLs and anything else in my .htaccess were getting ignored. Took me awhile to see that the redirects would still work with port 80, since my C5 canonical URL was set to the https version and port 80 was getting redirected to 443 even without an .htaccess rule to do so.

So I edited with vi (it says not to do this, lol) restarted Apache and all was working as it should. Pretty URLs were no longer 404ing.

I have since found a way through WHM to edit the VirtualHost config that won't get overwritten by WHM/cPanel like the httpd.conf file will if any changes are made via WHM/cPanel in the future.

When logged into WHM, go to Apache Configuration >> Include Editor and put your VirtualHost directives in the file pre_virtualhost_global.conf (or you can specify an Apache version instead of global if you prefer)

And in the future, really try to convince your clients to use another hosting platform :)

Hope this helps someone else.