Page 1 of 1

[solved] Prettyurls på one (index.php/side)

Posted: Sun Nov 08, 2009 10:30 pm
by nocs666
hej :)

Jeg sidder og roder med prettyurls på min hjemmeside på one.com. Har fået lavet det, men når man trykker på et link i menuen kommer den hen på www.eksempel.dk/index.php/kontakt/ altså tilføjer den index.php som jeg gerne vil have væk også.

Min config.php (udvalgt):

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

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

#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'] = 'side';
og .htaccess:

Code: Select all

RewriteEngine on
RewriteBase /

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

# 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?side=$1 [QSA]
På forhånd tak  ;)

Re: Prettyurls på one (index.php/side)

Posted: Mon Nov 16, 2009 7:22 pm
by lone
Hej nocs666 

Hvis du vil af med 'index.php' i midten af din url, skal du vælge 'mod_rewrite' som funktion.
Prøv med denne combination i config.php (kommentarerne er slettet):

Code: Select all

#------------
#URL Settings
#------------
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = ' ';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
og denne htaccess

Code: Select all

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Med disse to får du en URL som f.eks www.eksempel.dk/index.php/kontakt

Re: Prettyurls på one (index.php/side)

Posted: Mon Nov 16, 2009 7:24 pm
by lone
He - skulle være: www.eksempel.dk/kontakt

Re: Prettyurls på one (index.php/side)

Posted: Mon Nov 16, 2009 8:05 pm
by nocs666
Hej Lone

Tusind tak for hjælpen :) så virker det