Page 1 of 1

.htaccess rewrite rule not working help please! SOLVED

Posted: Thu Aug 09, 2007 8:52 am
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

Re: .htaccess rewrite rule not working help please!

Posted: Thu Aug 09, 2007 12:49 pm
by Metal Beryl
can anybody help?

Re: .htaccess rewrite rule not working help please!

Posted: Thu Aug 09, 2007 1:50 pm
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.

Re: .htaccess rewrite rule not working help please!

Posted: Thu Aug 09, 2007 4:02 pm
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?

Re: .htaccess rewrite rule not working help please!

Posted: Thu Aug 09, 2007 4:24 pm
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';

Re: .htaccess rewrite rule not working help please!

Posted: Thu Aug 09, 2007 4:47 pm
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

Re: .htaccess rewrite rule not working help please!

Posted: Thu Aug 09, 2007 4:50 pm
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...

Re: .htaccess rewrite rule not working help please!

Posted: Thu Aug 09, 2007 5:11 pm
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?

Re: .htaccess rewrite rule not working help please!

Posted: Thu Aug 09, 2007 5:26 pm
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();
}
}
}

Re: .htaccess rewrite rule not working help please!

Posted: Fri Aug 10, 2007 12:55 pm
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

Re: .htaccess rewrite rule not working help please!

Posted: Fri Aug 10, 2007 7:25 pm
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.

Re: .htaccess rewrite rule not working help please!

Posted: Mon Aug 13, 2007 7:53 am
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

Re: .htaccess rewrite rule not working help please!

Posted: Wed Aug 15, 2007 9:42 am
by Metal Beryl
Everything is working now. Thank you so much for all your help Pierre M.

Jane

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

Posted: Wed Aug 15, 2007 12:38 pm
by Dr.CSS
Care to share how you fixed it?...

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

Posted: Wed Aug 15, 2007 12:48 pm
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