Need help to fix htaccess redirects, pretty urls

A place to make for-pay "CMS made simple" job offerings
Locked
postiffm
Forum Members
Forum Members
Posts: 124
Joined: Tue Nov 30, 2010 12:16 am

Need help to fix htaccess redirects, pretty urls

Post by postiffm »

I have had a devil of a time trying to fox some redirect problems on my site. It sort of worked before, but it had strange 302 redirects that somehow the browser figured out, but it wasn't right for SEO or just general "cleanliness." Can someone here offer their services to help me out?

Here are the problems I know about

Problem #1

Code: Select all

http://www.fbcaa.org/cms/feeds/MAPBlog.rss
301 Moved Permanently
https://www.fbcaa.org/cms/feeds/MAPBlog.rss?page=feeds/MAPBlog.rss
200 OK
This doesn't look right. Before I started to try to fix the extra redirects, it used to just go to
https://www.fbcaa.org/cms/feeds/MAPBlog.rss

But if I click http://www.fbcaa.org/cms/feeds/MAPBlog.rss my browser sends me to http://www.fbcaa.org/cms/

Problem #2

Code: Select all

http://www.fbcaa.org/
302 Moved Temporarily
cms/index.php
301 Moved Permanently
https://www.fbcaa.org/cms/index.php
200 OK
The bare cms/index.php doesn't seem right, as does the 302 redirect.

Problem #3

Code: Select all

https://www.fbcaa.org/
302 Moved Temporarily
cms/index.php
200 OK
First of all, a 302 doesn't seem right. Second of all, the bare cms/index.php isn't right either.

Problem #4

Code: Select all

https://www.fbcaa.org/cms
301 Moved Permanently
https://www.fbcaa.org/cms/
200 OK
I guess this seems OK, but I doubt if anyone visits my site using this url anyway.

Problem #5
If in my browser I type http://www.fbcaa.org, it goes to
https://www.fbcaa.org/cms/index.php
But then if I click my "Home" menu item on the upper left of the Menu, it takes me to
https://www.fbcaa.org/cms/

I don't get why I have two names for my home page.

My CMS installation resides in public_html/cms, which might be part of the problem. I'm happy to have someone correct that if they think it is the best approach.

I have attached public_html/cms/.htaccess. Right now I do not have public_html/.htaccess.

Thanks,

Matt
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Need help to fix htaccess redirects, pretty urls

Post by velden »

Although you ask for commercial support I will give you this free hint :-)

https://www.cmscanbesimple.org/blog/set ... ade-simple

The order of the rules/rewrites is important I guess and you did change it.

First take care of the www and https stuff and then rewrite the pretty url:

Code: Select all

...
#
# The following is to enable pretty URLS, only applicable if url_rewriting is set to 'mod_rewrite' in the config.php
#
<IfModule rewrite_module>
RewriteEngine on
# If your CMSMS installation is in a subdirectory of your domain, you may need to specify the relative path (from the root of the domain) here.
# i.e: RewriteBase /cmsms
RewriteBase /cms

# +++++ ADD THIS - START +++++ from https://www.cmscanbesimple.org/blog/setting-up-ssl-in-cms-made-simple
  # Link to http(s)://website... then redirect to https://www.website...
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

  # Force URLs have https instead of http
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# +++++ ADD THIS - END +++++

# Rewrites urls in the form of /parent/child/grandchild but only rewrites if the requested URL is not a file or directory.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

</IfModule>
...
postiffm
Forum Members
Forum Members
Posts: 124
Joined: Tue Nov 30, 2010 12:16 am

Re: Need help to fix htaccess redirects, pretty urls

Post by postiffm »

Thank you very much. I made the change you said. I was not knowledgeable enough to know that the order of rules was critical. My current status is better, but not completely fixed, as far as I understand. Here is the list again:

Problem #1 is SOLVED! This was my worst problem.

Code: Select all

http://www.fbcaa.org/cms/feeds/MAPBlog.rss
301 Moved Permanently
https://www.fbcaa.org/cms/feeds/MAPBlog.rss
200 OK
Problem #2 is NOT SOLVED.

Code: Select all

http://www.fbcaa.org/
302 Moved Temporarily
cms/index.php
301 Moved Permanently
https://www.fbcaa.org/cms/index.php
200 OK
A temporary move to a wrong address followed by a permanent move seems wrong. And I don't even have any 302's in my .htaccess.

Problem #3 is NOT SOLVED.

Code: Select all

https://www.fbcaa.org/ (with or without the trailing slash)
302 Moved Temporarily
cms/index.php
200 OK
Why am I sending the bare cms/index.php back to the browser? It is meaningless.

Problem #4 is SOLVED.
Problem #5 is NOT SOLVED.

Code: Select all

	Two names for my home page. Navigating directly to www.fbcaa.org brings me to 
	https://www.fbcaa.org/cms/index.php
	But then if I click my "Home" menu item on the upper left of the Menu, it takes me to 
	https://www.fbcaa.org/cms/
Maybe it is not serious.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Need help to fix htaccess redirects, pretty urls

Post by velden »

Code: Select all

I have attached public_html/cms/.htaccess. Right now I do not have public_html/.htaccess.
Something is done to make your cmsms working from it's sub folder. This is not default behavior. So probably something in public_html is redirecting to cms/index.php. I bet it's a public_html/index.php file with a redirect in it.
postiffm
Forum Members
Forum Members
Posts: 124
Joined: Tue Nov 30, 2010 12:16 am

Re: Need help to fix htaccess redirects, pretty urls

Post by postiffm »

Yep...public_html/index.php has this in it:

Code: Select all

<?
   header("Location: cms/index.php");
   exit;
?>
This site has run CMS Made Simple for a long time (since at least version 1.4) and it had the CMS stuff in public_html/cms since then. How hard would it be to fix it up for default behavior and fix up these other redirects so they are right?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Need help to fix htaccess redirects, pretty urls

Post by velden »

Hard to say without having a look at both the backend (CMSMS admin) and having access to the server (cPanel or similar, shell access, database access).

Moving a CMSMS site is usually quite simple. But if there's other work to be done too it can be different of course.
postiffm
Forum Members
Forum Members
Posts: 124
Joined: Tue Nov 30, 2010 12:16 am

Re: Need help to fix htaccess redirects, pretty urls

Post by postiffm »

So, I'm hiring if you are interested in the job. I need to get this fixed up properly and you know what you are doing. I don't.
postiffm
Forum Members
Forum Members
Posts: 124
Joined: Tue Nov 30, 2010 12:16 am

Re: Need help to fix htaccess redirects, pretty urls

Post by postiffm »

For the record, if you must have CMS Made Simple installed in public_html/cms or somewhere else, the public_html/index.php redirect should be fully specified, like this:

Code: Select all

<?
   header("Location: https://www.fbcaa.org/cms/index.php", true, 301);
   exit;
?>
The temporary redirects to an abridged URI were coming from the wrong way I had it before:

Code: Select all

<?
   header("Location: cms/index.php");
   exit;
?>
because the header function defaults to return a 302 temporary.
victorcis
Forum Members
Forum Members
Posts: 26
Joined: Tue Feb 21, 2017 11:04 am

Re: Need help to fix htaccess redirects, pretty urls

Post by victorcis »

Hi,

I would love to help you on this. Let connect over S-ky-pe: cis.victor1
OR E-ma-il: victor.cisin10@gmail.com

Regards,
Victor
User avatar
deepvyas
Forum Members
Forum Members
Posts: 35
Joined: Fri May 19, 2017 1:03 pm
Contact:

Re: Need help to fix htaccess redirects, pretty urls

Post by deepvyas »

Hello,

I have check your post for detail mentioned and know how it can be helped.

let me know your available time and I will do my best to accommodate it.

We can discuss further on skype: deepvyas71

Best Regards,
Deep
postiffm
Forum Members
Forum Members
Posts: 124
Joined: Tue Nov 30, 2010 12:16 am

[SOLVED] Re: Need help to fix htaccess redirects, pretty url

Post by postiffm »

Thanks to user velden, my problem with redirects and pretty urls has been fixed.
Locked

Return to “Help Wanted (commercial)”