Page 1 of 1

URL disaster

Posted: Fri Jul 15, 2011 11:22 pm
by DADOCTOR
Hello,

Please help me I have tried to have a go at setting pretty URL's and have caused a major problem with opening front end and backend of my site

I opened config.php

and this is the section that I edited
#------------
#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 ... ty_URL.27s
$config['url_rewriting'] = ''

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

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

I added this

Code: Select all

$config['url_rewriting'] = 'mod_rewrite'; // this is new from 1.6
$config['page_extension'] = '.html';
$config['use_hierarchy'] = true; // this will be the standard from 1.7
$config['query_var'] = 'page';
What should have been default written

after

Code: Select all

$config['url_rewriting'] = '
between the '.....' ?

I cant open anything please help
yes I am a noob ???

Re: URL disaster

Posted: Sat Jul 16, 2011 1:41 pm
by mccord42
Here is what is in the config.php file by default

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['url_rewriting'] = 'none';

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

#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';
I would suggest removing everything between

Code: Select all

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

Code: Select all

#--------------
#Image Settings
#--------------
and then replacing it with the default code.

Did you just add those lines you listed to the config.php? Or did you replace the existing lines in the file? You should just edit the lines in the file. Any line WITHOUT a # at the beginning is an actual line of code that will be read and used by cmsms. If you just added those lines and kept the others as well, that would cause issues.

Re: URL disaster

Posted: Sun Jul 17, 2011 12:06 am
by DADOCTOR
Thanks mccord42,

I have fixed the problem,

But I still want to implement the a URL processed with mod_rewrite to look like this.

http://yourdomainname.com/cmsms/parent_item/child_item

I have had a look at the user handbook and this page and still am in the shit

http://wiki.cmsmadesimple.org/index.php ... ty_URL.27s

I have already added most of the content to my site and I am not sure if this is a problem, as- should I have originally set this up before adding pages/content ?

The other thing is that I am adding cmsms to link together an existing site that has a forum and a blog

My website url is - crimecasefiles.com

this url is set to redirect to my forum - crimecasefiles.com/forum

When I have finished working on my cmsms content I want it to use crimecasefiles.com (for my home page)

So when I added cmsms I use http://www.crimecasefiles.com/index.php? so that I could work on my site but not really have it open to public.

In my .htaccess file I have this in it for the other areas of my website.

Code: Select all

RewriteEngine on
#RewriteEngine On
#RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

# BEGIN WordPress

# END WordPress

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 87.250.254.24
RewriteCond %{HTTP_HOST} ^crimecasefiles.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.crimecasefiles.com$
RewriteRule ^/?$ "http\:\/\/www\.crimecasefiles\.com\/forum" [R=301,L]

Options +FollowSymLinks
RewriteEngine on
can I add to this under existing content ?

and is this what I add ?

Code: Select all

Options +FollowSymLinks
RewriteEngine on
 
# 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,NE]
 
# 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=$1 [QSA,NE]

Then the last thing I need to do is edit config.php

This is how it looks now

Code: Select all

#http://wiki.cmsmadesimple.org/index.php/FAQ/Installation/Pretty_URLs#Pretty_URL.27s
$config['url_rewriting'] = 'none';

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

#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';
do I change

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

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



Do I need
$config['query_var'] = 'page';

Thanks, I'm almost there ( I think)
there seems to be a few different examples of how to do this but they are different.

Re: URL disaster

Posted: Tue Jul 19, 2011 8:29 am
by DADOCTOR
Even if someone can answer one of my questions
it would be a great help

Thanks :-\

Re: URL disaster

Posted: Tue Jul 19, 2011 10:20 am
by uniqu3
It should work if you add in your .htaccess

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA,NE]
And your config.php

Code: Select all

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

Re: URL disaster

Posted: Wed Jul 20, 2011 7:54 am
by DADOCTOR
Thanks uniqu3,

Should I leave this as it is
$config['query_var'] = 'page';
?

and leave this

Code: Select all

$config['page_extension'] = '';
just like this

Re: URL disaster

Posted: Wed Jul 20, 2011 7:56 am
by uniqu3
yes you can leave query as is, for page_extension enter what extnesion you want to have .html, .php or leave empty for none.