htaccess problems

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
jjbakker
Forum Members
Forum Members
Posts: 13
Joined: Tue Jan 15, 2008 9:34 pm

htaccess problems

Post by jjbakker »

Hi Folks,

I'm having a problem with redirecting (htaccess 301) my old site url's (not cmsms) to my brandnew cmsms site.

The current site uses urls like:

www.flevovoet.nl/index.php?id=behandeling  (This is NOT cmsms)

the new cms sites users urls like:

www.flevovoet.nl/overzicht-behandelingen/


other examples:

index.php?id=klachten -> /voetklachten/

I can't get those redirects to work in .htaccess  I _think_ that CMSMS is already using ?id= as an internal variable.

Currently i'm using the default cmsms htaccess for pretty urls (mod_rewrite).

Code: Select all

RewriteEngine on
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
What do i need to add to .htaccess to get the above examples redirected? It's only for about 8 pages, so manually adding 8 rules is not a problem at all.

This is quite an issue because of the current google rankings.
Last edited by jjbakker on Fri Feb 01, 2008 7:09 am, edited 1 time in total.
andyash

Re: htaccess problems

Post by andyash »

Have you made changes to your config.php? Even that is required to get the .htaccess to work properly. I found the .htaccess code in the forums but could not make the file extension bit work. I see that you are using it without the file extension, so it should work in your case.

Use the settings below in your config.php. Most probably the "True" below is "False" in your case.

#------------
#URL Settings
#------------

#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = true;

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '/';

#If you don't use mod_rewrite, then would you like to use the built-in
#pretty url mechanism?  This will not work with IIS and the {metadata} tag
#should be in all of your templates before enabling.
$config['internal_pretty_urls'] = true;

#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy?  (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = true;

#If using none of the above options, what should we be using for the query string
#variable?  (ex. http://www.mysite.com/index.php?page=somecontent)
$config['query_var'] = 'page';
jjbakker
Forum Members
Forum Members
Posts: 13
Joined: Tue Jan 15, 2008 9:34 pm

Re: htaccess problems

Post by jjbakker »

My config is exactly like that except:

$config['internal_pretty_urls'] = true;  = false in my case because i use Mod_rewrite
jjbakker
Forum Members
Forum Members
Posts: 13
Joined: Tue Jan 15, 2008 9:34 pm

Re: htaccess problems

Post by jjbakker »

Somehow it seems that the ?id= is just ignored...

Anyone can help?
jjbakker
Forum Members
Forum Members
Posts: 13
Joined: Tue Jan 15, 2008 9:34 pm

Re: htaccess problems

Post by jjbakker »

Just had an idea..

Will it be a problem within CMSMS if i add something like this to the index.php?

Code: Select all

if (isset($_REQUEST['id']))
$idcheck = $_GET['id'];
switch ($idcheck) {
;
	case "behandeling":	 Header( "HTTP/1.1 301 Moved Permanently" );
                                         Header( "Location: http://www.flevovoet.nl/overzicht-behandelingen" );
				         break;
}
Can that be addid without problems?
Pierre M.

Re: htaccess problems

Post by Pierre M. »

Hello,
jjbakker wrote: Hi Folks,

I'm having a problem with redirecting (htaccess 301) my old site url's (not cmsms) to my brandnew cmsms site.

The current site uses urls like:

www.flevovoet.nl/index.php?id=behandeling  (This is NOT cmsms)

the new cms sites users urls like:

www.flevovoet.nl/overzicht-behandelingen/
What about puting some

Code: Select all

Redirect permanent /index.php?id=this /that
lines in your .htaccess before the CMSms specific stuff ?

Pierre M.
jjbakker
Forum Members
Forum Members
Posts: 13
Joined: Tue Jan 15, 2008 9:34 pm

Re: htaccess problems

Post by jjbakker »

Pierre M. wrote:

What about puting some

Code: Select all

Redirect permanent /index.php?id=this /that
lines in your .htaccess before the CMSms specific stuff ?

Pierre M.
Pierre, tried that and everything i could think of. but that's not working :(
Pierre M.

Re: htaccess problems

Post by Pierre M. »

If this not CMSms specific 'tip' doesn't work there may be something strange at the webserver level to be talked about with your hosting provider. Try simple static permanent redirects alone to know.

Or do as if your new URLs were on a separate hosting :

Code: Select all

Redirect permanent /index.php?id=this http://www.thenewhosting.com/that
Set up a rewritelog to know what is happening.

Pierre
jjbakker
Forum Members
Forum Members
Posts: 13
Joined: Tue Jan 15, 2008 9:34 pm

Re: htaccess problems

Post by jjbakker »

Where and how can i setup a rewrite log?
Pierre M.

Re: htaccess problems

Post by Pierre M. »

Please... read Apache's documentation. This is not CMSms specific.

Pierre M.
Post Reply

Return to “CMSMS Core”