[SOLVED]Can't configure pretty url on ovh business...

This is a FORK of the CMS Made Simple project and is not oficially supported in any way by the CMS Made Simple development team.
Locked
valactive
New Member
New Member
Posts: 3
Joined: Tue Sep 07, 2010 11:26 am

[SOLVED]Can't configure pretty url on ovh business...

Post by valactive »

Hello,
I just install the last version of cmsms mle and all is okay, good!
but.. when i try to configure pretty url (.htaccess and config.php), the url is okay but content do not change ??

your can see the site : www.joetmoi.com
This is my .htaccess :

Code: Select all

Options -Includes
SetEnv REGISTER_GLOBALS 0
SetEnv ZEND_OPTIMIZER 1
SetEnv PHP_VER 5
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "A2592000"
ExpiresByType image/jpg "A2592000"
ExpiresByType image/jpeg "A2592000"
ExpiresByType image/png "A2592000"
ExpiresByType image/x-icon "A2592000"
ExpiresByType application/pdf "A2592000"
ExpiresByType text/css "A2592000"
ExpiresByType text/html "A86400"
ExpiresByType application/javascript "A2592000"
ExpiresDefault "access plus 1 days"
<Files "index.html">
ExpiresByType text/html "now"
</Files>
</IfModule>


Options -Indexes
ServerSignature Off
#Options +FollowSymLinks

<IfModule mod_rewrite.c>
# BEGIN CMSMS and Rewrite Rules
RewriteEngine On

# Might be needed esp in a subdirectory
RewriteBase /joetmoi.com

# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"

RewriteCond %{QUERY_STRING} http\: [OR]

#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]

#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a "<__script__>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) 
RewriteRule ^.*$ - [F,L] 

# CMSMS Rewriting
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#comment monolingual rule and uncomment MLE rule
#RewriteRule ^(.+)$ /index.php?page=$1 [QSA]

RewriteRule ^([^/]+)/(.*)$ /index.php?page=$2&hl=$1 [QSA]

</IfModule>
and here my config.php :

Code: Select all

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

#What type of URL rewriting should we be using for pretty URLs?  Valid options are:
#'none', 'internal', and 'mod_rewrite'.  'internal' will not work with IIS some CGI
#configurations. 'mod_rewrite' requires proper apache configuration, a valid
#.htaccess file and most likely {metadata} in your page templates.  For more
#information, see:
#http://wiki.cmsmadesimple.org/index.php/FAQ/Installation/Pretty_URLs#Pretty_URL.27s

$config['assume_mod_rewrite'] = true;


$config['url_rewriting'] = 'mod_rewrite';

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

$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';
If you have an idea about what i make wrong.. i'll be enjoy to read your advices.

Thank's and sorry for my poor english  :P
Valéry
Last edited by valactive on Tue Sep 07, 2010 4:08 pm, edited 1 time in total.
alby

Re: Can't configure pretty url on ovh business...

Post by alby »

You have done a mistake  ::)
Have you read FAQ and your config.php?

valactive wrote: This is my .htaccess :
....
# Might be needed esp in a subdirectory
RewriteBase /joetmoi.com
....
and here my config.php :
....
$config['assume_mod_rewrite'] = true; Come from?

$config['url_rewriting'] = 'mod_rewrite';

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

$config['internal_pretty_urls'] = true; Come from?
....

Start with a minimum changed and look if works

Alby
valactive
New Member
New Member
Posts: 3
Joined: Tue Sep 07, 2010 11:26 am

Re: Can't configure pretty url on ovh business...

Post by valactive »

Thank's Alby,
I try without this two line in config.php

Code: Select all

$config['assume_mod_rewrite'] = true;
$config['internal_pretty_urls'] = true;
and i comment the RewriteBase in my htaccess.

Still the same, the url is good, like : http://www.joetmoi.com/fr/home but the content doesn't load in function of the lang parameter.

If you have any ideas...

Best
Valéry
valactive
New Member
New Member
Posts: 3
Joined: Tue Sep 07, 2010 11:26 am

Re: Can't configure pretty url on ovh business...

Post by valactive »

so stupid i am!
just put my .htaccess in a wrong place... now, work like a sharm.

Apologies for time and thank's again.

Valéry
User avatar
map_1961
Power Poster
Power Poster
Posts: 387
Joined: Fri Apr 20, 2007 7:26 pm
Location: Ruhrstadt

Re: [SOLVED]Can't configure pretty url on ovh business...

Post by map_1961 »

Hi Alby and the others using mle:

we tried to and the pretty url functionality to an just to 1.8.2 mle upgraded mirrored mle system:
http://mydomain.de/pub_test/

where '/pub_test/' is the root to the mirrored system

.htaccess looks like this:

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

Options +FollowSymLinks
RewriteEngine on
RewriteBase /pub_test/

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# except for form POSTS
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_METHOD} !POST$
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
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/(.*)$ index.php?page=$2&hl=$1 [QSA]



The config looks like this:

$config['url_rewriting'] = 'mod_rewrite';

$config['page_extension'] = '/';

$config['use_hierarchy'] = true;

$config['query_var'] = 'page';


The result looks like this (tmp, cache and templates_C are on 777):
Site down for maintenance.
"; exit; } if (!is_writable(TMP_TEMPLATES_C_LOCATION) || !is_writable(TMP_CACHE_LOCATION)) { echo ''; echo '

The following directories must be writable by the web server:
'; echo 'tmp/cache
'; echo 'tmp/templates_c
'; echo '

Please correct by executing:
chmod 777 tmp/cache
chmod 777 tmp/templates_c
or the equivilent for your platform before continuing.
'; echo ''; exit; } require_once($dirname.'/include.php'); // optionally enable output compression (as long as debug mode isn't on) if( isset($config['output_compression']) && ($config['output_compression']) && $config['debug'] != true ) { @ob_start('ob_gzhandler'); } else { @ob_start(); } $params = array_merge($_GET, $_POST); $smarty = &$gCms->smarty; $smarty->params = $params; $page = get_pageid_or_alias_from_url(); $pageinfo = ''; if( $page == '__CMS_PREVIEW_PAGE__' && isset($_SESSION['cms_preview']) ) // temporary { $tpl_name = trim($_SESSION['cms_preview']); $fname = ''; if (is_writable($config["previews_path"])) { $fname = cms_join_path($config["previews_path"] , $tpl_name); } else { $fname = cms_join_path(TMP_CACHE_LOCATION , $tpl_name); } $fname = $tpl_name; if( !file_exists($fname) ) { die('error preview temp file not found: '.$fname); return false; } // build pageinfo $fh = fopen($fname,'r'); $_SESSION['cms_preview_data'] = unserialize(fread($fh,filesize($fname))); fclose($fh); unset($_SESSION['cms_preview']); $pageinfo = PageInfoOperations::LoadPageInfoFromSerializedData($_SESSION['cms_preview_data']); $pageinfo->content_id = '__CMS_PREVIEW_PAGE__'; } if( !is_object($pageinfo) ) { $pageinfo = PageInfoOperations::LoadPageInfoByContentAlias($page); } // $page cannot be empty here if (isset($pageinfo) && $pageinfo !== FALSE) { $gCms->variables['pageinfo'] =& $pageinfo; if( isset($pageinfo->template_encoding) && $pageinfo->template_encoding != '' ) { set_encoding($pageinfo->template_encoding); } if($pageinfo->content_id > 0) { $manager =& $gCms->GetHierarchyManager(); $node =& $manager->sureGetNodeById($pageinfo->content_id); if(is_object($node)) { $contentobj =& $node->GetContent(true,true,false); if( !$contentobj->IsViewable() ) { $url = $contentobj->GetURL(); if( $url != '' && $url != '#' ) { redirect($url); } } if( is_object($contentobj) ) { $smarty->assign('content_obj',$contentobj); } } } $gCms->variables['content_id'] = $pageinfo->content_id; $gCms->variables['page'] = $page; $gCms->variables['page_id'] = $page; $gCms->variables['page_name'] = $pageinfo->content_alias; $gCms->variables['position'] = $pageinfo->content_hierarchy; global $gCms; $contentops =& $gCms->GetContentOperations(); $gCms->variables['friendly_position'] = $contentops->CreateFriendlyHierarchyPosition($pageinfo->content_hierarchy); $smarty->assign('content_id', $pageinfo->content_id); $smarty->assign('page', $page); $smarty->assign('page_id', $page); $smarty->assign('page_name', $pageinfo->content_alias); $smarty->assign('page_alias', $pageinfo->content_alias); $smarty->assign('position', $pageinfo->content_hierarchy); $smarty->assign('friendly_position', $gCms->variables['friendly_position']); } else // else if (get_site_preference('enablecustom404') == '' || get_site_preference('enablecustom404') == "0") { ErrorHandler404(); exit; } $html = ''; $cached = ''; $showtemplate = true; if ((isset($_REQUEST['showtemplate']) && $_REQUEST['showtemplate'] == 'false') || (isset($smarty->id) && $smarty->id != '' && isset($_REQUEST[$smarty->id.'showtemplate']) && $_REQUEST[$smarty->id.'showtemplate'] == 'false')) { $showtemplate = false; } if (isset($_GET["print"])) { //Start MLE ($smarty->is_cached('print:'.$page, '', $pageinfo->template_id.'-'.$hl)?$cached="":$cached="not "); $html = $smarty->fetch('print:'.$page, '', $pageinfo->template_id.'-'.$hl) . "\n"; //End MLE } else { #If this is a case where a module doesn't want a template to be shown, just disable caching if( !$showtemplate ) { //Start MLE $html = $smarty->fetch('template:notemplate', '', $hl) . "\n"; //End MLE } else { $smarty->caching = false; $smarty->compile_check = true; //Start MLE ($smarty->is_cached('template:'.$pageinfo->template_id, '', $hl)?$cached="":$cached="not "); //End MLE // we allow backward compatibility (for a while) // for people that have hacks for setting page title // or header variables by capturing a modules output // to a smarty variable, and then displaying it later. if( isset($config['process_whole_template']) && $config['process_whole_template'] === false ) { //Start MLE $top = $smarty->fetch('tpl_top:'.$pageinfo->template_id, '', $hl); $body = $smarty->fetch('tpl_body:'.$pageinfo->template_id, '', $hl); $head = $smarty->fetch('tpl_head:'.$pageinfo->template_id, '', $hl); //End MLE $html = $top.$head.$body; } else { //Start MLE $html = $smarty->fetch('template:'.$pageinfo->template_id, '', $hl); //End MLE } } } #if ((get_site_preference('enablecustom404') == '' || get_site_preference('enablecustom404') == "0") && (!$config['debug'])) #{ # set_error_handler($old_error_handler); #} #if (!$cached) #{ #Perform the content postrendernoncached callback # reset($gCms->modules); # while (list($key) = each($gCms->modules)) # { # $value =& $gCms->modules[$key]; # if ($gCms->modules[$key]['installed'] == true && # $gCms->modules[$key]['active'] == true) # { # $gCms->modules[$key]['object']->ContentPostRenderNonCached($html); # } # } // this event doesn't exist in 1.7.x //Events::SendEvent('Core', 'ContentPostRenderNonCached', array(&$html)); #} #Perform the content postrender callback #reset($gCms->modules); #while (list($key) = each($gCms->modules)) #{ # $value =& $gCms->modules[$key]; # if ( isset($gCms->modules[$key]['installed']) && # $gCms->modules[$key]['installed'] == true && # $gCms->modules[$key]['active'] == true) # { # $gCms->modules[$key]['object']->ContentPostRender($html); # } #} Events::SendEvent('Core', 'ContentPostRender', array('content' => &$html)); header("Content-Type: " . $gCms->variables['content-type'] . "; charset=" . (isset($pageinfo->template_encoding) && $pageinfo->template_encoding != ''?$pageinfo->template_encoding:get_encoding())); echo $html; @ob_flush(); $endtime = microtime(); $db =& $gCms->GetDb(); $memory = (function_exists('memory_get_usage')?memory_get_usage():0); $memory = $memory - $orig_memory; $memory_peak = (function_exists('memory_get_peak_usage')?memory_get_peak_usage():0); if ( !is_sitedown() && $config["debug"] == true) { echo "

Generated in ".microtime_diff($starttime,$endtime)." seconds by CMS Made Simple using ".(isset($db->query_count)?$db->query_count:'')." SQL queries and {$memory} bytes of memory (peak memory usage was {$memory_peak})
"; } else if( isset($config['show_performance_info']) && ($showtemplate == true) ) { echo "\n"; } if( is_sitedown() || $config['debug'] == true) { $smarty->clear_compiled_tpl(); #$smarty->clear_all_cache(); } if ( !is_sitedown() && $config["debug"] == true) { #$db->LogSQL(false); // turn off logging # output summary of SQL logging results #$perf = NewPerfMonitor($db); #echo $perf->SuspiciousSQL(); #echo $perf->ExpensiveSQL(); #echo $sql_queries; foreach ($gCms->errors as $error) { echo $error; } } if( $page == '__CMS_PREVIEW_PAGE__' && isset($_SESSION['cms_preview']) ) // temporary { unset($_SESSION['cms_preview']); } # vim:ts=4 sw=4 noet ?>




Who knows what is wrong?

Thanks

map_1961
Last edited by map_1961 on Tue Sep 28, 2010 1:15 pm, edited 1 time in total.
map_1961
Locked

Return to “[locked] CMSMS MLE fork”