[Pretty URLs] - i can't get it to work

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.
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

[Pretty URLs] - i can't get it to work

Post by rtkd »

hi,

i am trying to use pretty urls with a new site.
i followed all the adivces here, but can't get it to work.

the startpage gets displayed, but if i try to follow a link i get "object not found".

help on this is greatly appreciated!
i included the files i set up.

server: apache
{metadata} included

.htaccess

Code: Select all


php_flag magic_quotes_gpc Off
php_flag register_globals Off
php_flag session.use_trans_sid Off

# Turns off directory browsing
# not absolutely essential, but keeps people from snooping around without 
# needing empty index.html files everywhere
Options -Indexes

# Deny access to config.php
# This can be useful if php ever breaks or dies
# Use with caution, this may break other functions of CMSms that use a config.php
# file.  This may also break other programs you have running under your CMSms
# install that use config.php.  You may need to add another .htaccess file to those
# directories to specifically allow config.php.
<Files "config.php">
	order allow,deny
	deny from all
</Files>

# No sense advertising what we are running
ServerSignature Off


# Make sure you have Options FollowSymLinks
# and Allow on
#Options +FollowSymLinks
RewriteEngine On

# Might be needed in a subdirectory
#RewriteBase /

# 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}) [OR]
#IF the URI contains UNION
RewriteCond %{QUERY_STRING} UNION [OR]
#OR if the URI contains a *
RewriteCond %{QUERY_STRING} \*
#then deny the request (403)
RewriteRule ^.*$ - [F,L]
# End URL Filtering


# CMSMS Rewriting
# Set assume mod_rewrite to true in config.php and clear CMSMS cache
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# END CMSMS
# END Rewrite rules


cofig.php

Code: Select all


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

Last edited by rtkd on Sun Apr 06, 2008 4:33 pm, edited 1 time in total.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: [Pretty URLs] - i can't get it to work

Post by applejack »

Use $config['internal_pretty_urls'] = true;

Website Design & Production
http://www.applejack.co.uk
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: [Pretty URLs] - i can't get it to work

Post by rtkd »

sure that works but its not what i want ;)
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: [Pretty URLs] - i can't get it to work

Post by applejack »

So what do you want then you need to explain more clearly.

Website Design & Production
http://www.applejack.co.uk
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: [Pretty URLs] - i can't get it to work

Post by rtkd »

if i use $config['internal_pretty_urls'] = true; i get --> index.php/page.html
but i want www.site.de/page.html
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: [Pretty URLs] - i can't get it to work

Post by applejack »

$config['root_url'] = 'http://www.site.de';

$config['page_extension'] = '';

Options +FollowSymLinks

# 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]


see if that helps
Last edited by applejack on Mon Apr 07, 2008 12:02 pm, edited 1 time in total.

Website Design & Production
http://www.applejack.co.uk
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: [Pretty URLs] - i can't get it to work

Post by rtkd »

nope same prob as in first post.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: [Pretty URLs] - i can't get it to work

Post by applejack »

Did you uncomment the line

Options +FollowSymLinks

Website Design & Production
http://www.applejack.co.uk
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: [Pretty URLs] - i can't get it to work

Post by rtkd »

jep
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: [Pretty URLs] - i can't get it to work

Post by applejack »

In that case I don't think your .htacccess file is working for some reason as the line RewriteRule ^(.+)$ index.php?page=$1 [QSA] is what rewrites it to friendly URL's I have never had any trouble getting it to work. It maybe something to do with the server configuration. Sorry can't help you anymore.

Website Design & Production
http://www.applejack.co.uk
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: [Pretty URLs] - i can't get it to work

Post by rtkd »

kk. no problem. ty anyway!

i was thinking about it having something to do with the server config,
because i tried to implement the security features from another thread - making access to admin dir via https -
and that didnt work also.

i know there is something in httpd.conf thats allows/disallows .htaccess but i cant remember the line or name :-/
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: [Pretty URLs] - i can't get it to work

Post by applejack »

It maybe this line

RewriteOptions inherit

which is in the vhosts file in /etc/httpd/conf/vhosts/sitenumber

On my server at least.

Website Design & Production
http://www.applejack.co.uk
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: [Pretty URLs] - i can't get it to work

Post by rtkd »

i have this site on xampp... cant find that file :(
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: [Pretty URLs] - i can't get it to work

Post by rtkd »

update:

i found and fixed 2 misstakes i made

1. i didn't uncomment #Options +FollowSymLinks
2. i had override disallowed in httpd.conf

so now one security feature (https for admin dir) works,
but i still cant get pretty urls and url-filtering to run propperly.

if anyone could hook me up with some kind of additional information or solution for this,
i'd really appreciate it.

rtkd
Last edited by rtkd on Tue Apr 08, 2008 1:00 pm, edited 1 time in total.
twen88
Forum Members
Forum Members
Posts: 118
Joined: Thu Aug 16, 2007 8:07 pm

Re: [Pretty URLs] - i can't get it to work

Post by twen88 »

Some web servers are not supporting "mod_rewrite", have you checked on this?
Post Reply

Return to “CMSMS Core”