Article: Installation > Clean Urls

Submit and proof-read articles for the documentation here. Anyone is welcome to contribute!
Post Reply
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

Article: Installation > Clean Urls

Post by kishman155 »

If you want to to use clean URL's like something.shtml and not index.php?page=something then

go on reading

Step 1

Copy file htaccess.txt from Your /doc directory to Your webroot and rename it to '.htaccess'

Step 2


Make sure there is line "$config['assume_mod_rewrite'] = true;" in Your /config.php file

Thats it now you have cleen Url's in your address

Was it not simple
F4n4TiC

Re: Article: Installation > Clean Urls

Post by F4n4TiC »

But how htaccess the file is to read?
Much-calibrated so:

Code: Select all

RewriteEngine on 
RewriteRule ^seite_(.*).html$ index.php?page=$1
Please help!
Nanochild

Re: Article: Installation > Clean Urls

Post by Nanochild »

No, it WAS NOT SIMPLE he he...  ???  :-\  ::)  :o

I have no problem with clean URLs as you can see here and the .htaccess to this looks like this:

Code: Select all

php_flag magic_quotes_gpc Off
php_flag register_globals Off
php_flag session.use_trans_sid Off

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

#Rewrites page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.+)\.html$ index.php?page=$1 [QSA]
But on my subdomain i got an HTTP 404 error (it works fine now) and the .htaccess was exactly the same:

Code: Select all

php_flag magic_quotes_gpc Off
php_flag register_globals Off
php_flag session.use_trans_sid Off

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

#Rewrites page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.+)\.html$ index.php?page=$1 [QSA]
In both examples the config.php file have these values:

Code: Select all

$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '.html';
So after my hair had grown long into the machinery (me and my computer are now one unit) i wrote that i could try to use this:

Code: Select all

RewriteBase /
So, for my subdomain on exactly the same server, i take the .htaccess file and put this RewriteBase / in just before the RewriteCond %{REQUEST_FILENAME} !-f [NC] so it looks like this:

Code: Select all

php_flag magic_quotes_gpc Off
php_flag register_globals Off
php_flag session.use_trans_sid Off

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

#Rewrites page.shtml as index.php?page
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.+)\.html$ index.php?page=$1 [QSA]
...and now it works..!

Server info:

Apache/2.0.51 (Fedora)
PHP Version 4.3.10


Sincerely
Nano
Last edited by Nanochild on Sun May 07, 2006 5:32 pm, edited 1 time in total.
Post Reply

Return to “Suggestions, Modifications & Corrections”