.htaccess rewrite rule not working help please! SOLVED

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
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

.htaccess rewrite rule not working help please! SOLVED

Post by Metal Beryl »

I have a website in a folder on my cgi server, I need to direct a url to that folder. I have managed to do this by using the following .htaccess code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.rapidreality.co.uk$ [nc]
RewriteCond %{REQUEST_URI} !^/Product/
RewriteRule (.*) /Product/$1 [L]

It links to the index page but none of the links work. Can anyone help?

You can find the site here www.rapidreality.co.uk

Thanks
Last edited by Metal Beryl on Wed Aug 15, 2007 9:42 am, edited 1 time in total.
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: .htaccess rewrite rule not working help please!

Post by Metal Beryl »

can anybody help?
Pierre M.

Re: .htaccess rewrite rule not working help please!

Post by Pierre M. »

Hello,

I don't understand what you want :
-the .htaccess you show does exactly what you tell it to do : prefix URLs with /Product/
-I suppose your site would work without this prefixing and breaking .htaccess

If you want your CMSms site to be under .co.uk/folder/ rather than .co.uk/ there is nothing to do : just rename the "cmsmadesimple" folder to "folder" (just before running the installer).

Pierre M.
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: .htaccess rewrite rule not working help please!

Post by Metal Beryl »

The cgi server is with plus net and you have to use it by creating the websites in a folder. The only way to link your url to the folder is by using the .htaccess direction. The .htaccess redirect sits on the cgi server outside the cms made simple folders. Which I have done and it links to the index page but the links no longer work!

when you click on a menu link it comes up with:

Not Found

The requested URL /product/approach was not found on this server.

Do i need to change anything in the config.php or any other cms made simple code for it to work?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: .htaccess rewrite rule not working help please!

Post by Dr.CSS »

This is mine for subfolder installs...

RewriteEngine On
Options FollowSymLinks
# set this to be an absolute path from your webservers document root
# if you've installed CMS into /foo then set this to /foo
RewriteBase / thenameofthefolder/
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

And the config.php...

#------------
#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'] = '.html';

#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'] = false;

#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'] = false;

#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';
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: .htaccess rewrite rule not working help please!

Post by Metal Beryl »

cool, so my links work now but i cant access my admin area.

When I go here...

http://www.rapidreality.co.uk/product/admin

It comes up with this...

http://www.rapidreality.co.uk/product/a ... duct/admin

Then shows this message...

Fatal error: Call to undefined function: issyntaxhighlighter() in /share/storage/01/de/designreality/product/admin/footer.php on line 80

Thanks for the help so far
Jane
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: .htaccess rewrite rule not working help please!

Post by Dr.CSS »

Do you have a syntacs hiliter installed, I would FTP to site and change name of folder or download then delete it...
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: .htaccess rewrite rule not working help please!

Post by Metal Beryl »

mark wrote: Do you have a syntacs hiliter installed, I would FTP to site and change name of folder or download then delete it...
What do you mean sorry? What is a syntacs hiliter?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: .htaccess rewrite rule not working help please!

Post by Dr.CSS »

The error references it "undefined function: issyntaxhighlighter()" ... make sure you have the right permissions on the folders...
admin is 755
that file is  644

Also look in the config.php for the wrong paths...

mine...

#-------------
#Path Settings
#-------------

#Document root as seen from the webserver.  No slash at the end
#If page is requested with https use https as root url
#e.g. http://blah.com
$config['root_url'] = 'http://yoursite.com/thenameofthefolder';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')
{
$config['root_url'] = str_replace('http','https',$config['root_url']);
}

#Path to document root. This should be the directory this file is in.
#e.g. /var/www/localhost
$config['root_path'] = '/homepages/24/d151200904/htdocs/thenameofthefolder';

#Name of the admin directory
$config['admin_dir'] = 'admin';

#Where do previews get stored temporarily?  It defaults to tmp/cache.
$config['previews_path'] = '/homepages/24/d151200904/htdocs/thenameofthefolder/tmp/cache';

#Where are uploaded files put?  This defaults to uploads.
$config['uploads_path'] = '/homepages/24/d151200904/htdocs/thenameofthefolder/uploads';

#Where is the url to this uploads directory?
$config['uploads_url'] = $config['root_url'] . '/uploads';

From the file....

foreach($gCms->modules as $key=>$value)
{
if ($gCms->modules[$key]['installed'] == true &&
$gCms->modules[$key]['active'] == true &&
This is line 80 >>> $gCms->modules[$key]['object']->IsSyntaxHighlighter()
)
{
$loadit=false;
if ($gCms->modules[$key]['object']->SyntaxActive()) {
$loadit=true;
} else {
  if (get_preference(get_userid(), 'syntaxhightlighter')==$gCms->modules[$key]['object']->GetName()) {
  $loadit=true;
  }
}
if ($loadit) {
  $bodytext.=$gCms->modules[$key]['object']->SyntaxGenerateBody();
  $footertext.=$gCms->modules[$key]['object']->SyntaxGenerateHeader($htmlresult);
  $formtext.=$gCms->modules[$key]['object']->SyntaxPageForm();
  $formsubmittext.=$gCms->modules[$key]['object']->SyntaxPageFormSubmit();
}
}
}
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: .htaccess rewrite rule not working help please!

Post by Metal Beryl »

mark wrote: From the file....

foreach($gCms->modules as $key=>$value)
{
if ($gCms->modules[$key]['installed'] == true &&
$gCms->modules[$key]['active'] == true &&
This is line 80 >>> $gCms->modules[$key]['object']->IsSyntaxHighlighter()
)
{
$loadit=false;
if ($gCms->modules[$key]['object']->SyntaxActive()) {
$loadit=true;
} else {
  if (get_preference(get_userid(), 'syntaxhightlighter')==$gCms->modules[$key]['object']->GetName()) {
  $loadit=true;
  }
}
if ($loadit) {
  $bodytext.=$gCms->modules[$key]['object']->SyntaxGenerateBody();
  $footertext.=$gCms->modules[$key]['object']->SyntaxGenerateHeader($htmlresult);
  $formtext.=$gCms->modules[$key]['object']->SyntaxPageForm();
  $formsubmittext.=$gCms->modules[$key]['object']->SyntaxPageFormSubmit();
}
}
}
Not sure what you mean by this bit sorry!?

Jane
Pierre M.

Re: .htaccess rewrite rule not working help please!

Post by Pierre M. »

Hello again Jane,
Metal Beryl wrote: cool, so my links work now but i cant access my admin area.
The rewrite shouldn't rewrite for admin area (existing directory), should it ?
Here is a try. Please add :

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-d [NC]
So the extract becomes :

Code: Select all

RewriteBase / thenameofthefolder/
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Pierre M.
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: .htaccess rewrite rule not working help please!

Post by Metal Beryl »

Hi Pierre M,

I have tried that but i am still getting:

Fatal error: Call to undefined function: issyntaxhighlighter() in /share/storage/01/de/designreality/product/admin/footer.php on line 80

Not sure what to do? Anyone got any idea?

Jane
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: .htaccess rewrite rule not working help please!

Post by Metal Beryl »

Everything is working now. Thank you so much for all your help Pierre M.

Jane
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: .htaccess rewrite rule not working help please! SOLVED

Post by Dr.CSS »

Care to share how you fixed it?...
Metal Beryl
Forum Members
Forum Members
Posts: 69
Joined: Wed Apr 18, 2007 9:57 am

Re: .htaccess rewrite rule not working help please! SOLVED

Post by Metal Beryl »

I deleted the footer.php file and uploaded a new version from the cms made simple download!

My .htaccess document is...

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.mydomain.co.uk$ [nc]

RewriteCond %{REQUEST_URI} !^/myfolder/*
RewriteRule (.*) /myfolder/$1 [L]
RewriteBase /product/
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

and my config.php is set to:

#------------
#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'] = '.html';

#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'] = false;

#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'] = false;

#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';

#-------------
#Path Settings
#-------------

#Document root as seen from the webserver.  No slash at the end
#If page is requested with https use https as root url
#e.g. http://blah.com
$config['root_url'] = 'http://yoursite.com/thenameofthefolder';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')
{
$config['root_url'] = str_replace('http','https',$config['root_url']);
}

#Path to document root. This should be the directory this file is in.
#e.g. /var/www/localhost
$config['root_path'] = '/homepages/24/d151200904/htdocs/thenameofthefolder';

#Name of the admin directory
$config['admin_dir'] = 'admin';

#Where do previews get stored temporarily?  It defaults to tmp/cache.
$config['previews_path'] = '/homepages/24/d151200904/htdocs/thenameofthefolder/tmp/cache';

#Where are uploaded files put?  This defaults to uploads.
$config['uploads_path'] = '/homepages/24/d151200904/htdocs/thenameofthefolder/uploads';

#Where is the url to this uploads directory?
$config['uploads_url'] = $config['root_url'] . '/uploads';

Thanks for all your help!

Jane
Post Reply

Return to “CMSMS Core”