• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: 301 Redirects non-pretty to prettyURL
PostPosted: Fri Mar 17, 2017 2:32 pm 
Offline
Forum Members
Forum Members

Joined: Wed Jan 28, 2009 3:33 pm
Posts: 13
I recently changed my website from 1.0 to 2.0 CMSMS, and am now using PrettyURL. I have been unable to get any 301 redirects to work.

Tried the instructions here: https://www.cmscanbesimple.org/blog/red ... ade-simple

and none of those seem to work.

The old URLs index.php?page=pagename just go to the 404 page, no redirect. Not sure what I'm missing here.

Standard 301 redirects do not work either.

I have the redirects placed directly above the line "# Rewrites urls in the form of /parent/child/grandchild..."

I've tried varying formats, such as:

RewriteRule ^class-levels$ http://www.houstonswimclub.com/about [R=301,L]
RewriteRule ^index.php?page=class-levels$ http://www.houstonswimclub.com/about [R=301,L]

Neither have any effect. Any help is most appreciated!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 301 Redirects non-pretty to prettyURL
PostPosted: Fri Mar 17, 2017 3:59 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 7837
Location: Fernie British Columbia, Canada
In CMSMS the 'ugly' URL's should always work. This is what CMSMS understands and uses internally.

i.e: <site>/index.php?page=something
so should <site>/index.php?page=blah/blah/something

The 'page' string is determined by the 'query_var' config variable, and rarely changes. If you have it specified in your config.php you can probably remove it.

You should also remove your .htaccess temporarily to make sure that they do work as intended.

Now. Pretty URL's:

The whole goal of pretty URL's is to reformat a request of the format <site>/blah/blah/something into something that CMSMS can understand i.e: <site>/index.php?page=blah/blah/something.

That's what the sample htaccess file we distribute does.

Now 301 Redirects:
These are to tell the browser that a page has been moved permanently to a new location. But... note above that the <site>/index.php?page=blah/blah/something URL's are used internally by CMSMS.

So in your rewrite chain you must, at the end reformat everything to the ugly format anyways.

And if you look at the actual manual for RewriteRule and the attributes... you would realize that [R=301,L] will stop any further rewriting of that URL.

Personally, I would not bother trying to rewrite 'ugly' urls into their pretty form. I would rewrite the ugly urls ONLY if the end page alias changed. Because otherwise, the page hasn't really moved... it just has another way to access it.

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 301 Redirects non-pretty to prettyURL
PostPosted: Fri Mar 17, 2017 6:21 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 2753
Location: The Netherlands
And if you worry about Google (and others) keep indexing your old ugly urls; implement canonical urls


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 301 Redirects non-pretty to prettyURL
PostPosted: Mon Mar 20, 2017 2:48 pm 
Offline
Forum Members
Forum Members

Joined: Wed Jan 28, 2009 3:33 pm
Posts: 13
I'm not concerned with Google indexing the non-pretty URLs, as they still go to the same page as the prettyURL. I just need to reroute old links that don't exist anymore. Example, index.php?page=class-levels needs to go to index.php?page=about because the 'class-levels' page no longer exist.

Thanks for your help! I've tried utilizing the information you've given me but unfortunately I'm not comprehending it properly. I'm sure this is something rather simple that I simply am not understanding.

I've tried rewriting the redirects with the non-pretty format with no luck.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: 301 Redirects non-pretty to prettyURL  Topic is solved
PostPosted: Mon Mar 20, 2017 3:30 pm 
Offline
Forum Members
Forum Members

Joined: Wed Jan 28, 2009 3:33 pm
Posts: 13
Solved by putting directly under RewriteEngineon

RewriteCond %{QUERY_STRING} ^.*page=class-levels.*$
RewriteRule ^index http://www.houstonswimclub.com/about? [R=301,L]

for each broken link.

Thanks again for all your help!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting