Page 1 of 2

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

Posted: Sun Apr 06, 2008 4:31 pm
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';


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

Posted: Mon Apr 07, 2008 11:24 am
by applejack
Use $config['internal_pretty_urls'] = true;

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

Posted: Mon Apr 07, 2008 11:27 am
by rtkd
sure that works but its not what i want ;)

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

Posted: Mon Apr 07, 2008 11:38 am
by applejack
So what do you want then you need to explain more clearly.

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

Posted: Mon Apr 07, 2008 11:42 am
by rtkd
if i use $config['internal_pretty_urls'] = true; i get --> index.php/page.html
but i want www.site.de/page.html

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

Posted: Mon Apr 07, 2008 11:58 am
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

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

Posted: Mon Apr 07, 2008 12:58 pm
by rtkd
nope same prob as in first post.

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

Posted: Mon Apr 07, 2008 1:01 pm
by applejack
Did you uncomment the line

Options +FollowSymLinks

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

Posted: Mon Apr 07, 2008 1:27 pm
by rtkd
jep

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

Posted: Mon Apr 07, 2008 1:50 pm
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.

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

Posted: Mon Apr 07, 2008 2:02 pm
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 :-/

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

Posted: Mon Apr 07, 2008 2:37 pm
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.

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

Posted: Mon Apr 07, 2008 3:13 pm
by rtkd
i have this site on xampp... cant find that file :(

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

Posted: Tue Apr 08, 2008 12:58 pm
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

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

Posted: Tue Apr 08, 2008 4:03 pm
by twen88
Some web servers are not supporting "mod_rewrite", have you checked on this?