Pretty URL - mod_rewrite gives 404

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.
nilson
Forum Members
Forum Members
Posts: 15
Joined: Wed Apr 23, 2008 8:52 am

Pretty URL - mod_rewrite gives 404

Post by nilson »

Hello,
on my site pretty URLs are working with internal mode. My cms_root/config.php reads

Code: Select all

$config['url_rewriting'] = 'internal';
$config['page_extension'] = '.html';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
Now I want to get rid of the index.php in my Browser URL. When changing my config.php to

Code: Select all

$config['url_rewriting'] = 'mod_rewrite';
the internal URLs get rewritten to

Code: Select all

http://www.my-domain.com/cms/concept.html
but are not available under this URL (Error 404). I can only access my subpages when adding index.php by hand, like

Code: Select all

http://www.my-domain.com/cms/index.php/concept.html
In cms_root/.htaccess I got the following

Code: Select all

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# except for form POSTS
# RewriteCond %{REQUEST_URI} !/$
# RewriteCond %{REQUEST_URI} !\.
# RewriteCond %{REQUEST_METHOD} !POST$
# 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 ^(.+).html$ index.php?page=$1 [QSA]
What would I have to do in order to refer to my domain name instead of the ip address?
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm

Re: Pretty URL - mod_rewrite gives 404

Post by Russ »

I use the following and it works on Apache on Mac / Linux

Code: Select all

$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '/';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
.htaccess, looks OK but try commenting out

Code: Select all

"RewriteBase /" 
Hope this helps?
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Pretty URL - mod_rewrite gives 404

Post by Rolf »

If your website is in a subfolder, you need in this case:

Code: Select all

RewriteBase /cms
®olf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
nilson
Forum Members
Forum Members
Posts: 15
Joined: Wed Apr 23, 2008 8:52 am

Re: Pretty URL - mod_rewrite gives 404

Post by nilson »

Thanks Rolf,
unfortunately no success with

RewriteBase /cms

Maybe it´s important that I have defined an alias in the apache config that points /cms to the most up-to-date installation of cmsms 1.6.6)

Code: Select all

Alias /cms "/srv/www/cms_cofis/current/"
<Directory "/srv/www/cms_cofis/current/">
..
</Directory>
Thanks for any suggestions,
nilson
Last edited by nilson on Fri Dec 04, 2009 5:28 pm, edited 1 time in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Pretty URL - mod_rewrite gives 404

Post by Rolf »

Got a link? (PM)

®
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Pretty URL - mod_rewrite gives 404

Post by Rolf »

Nilson,
Thanks for the link.
Can you please put your system information here.
And can you turn on the mod_rewrite so I can see it myself
®
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
nilson
Forum Members
Forum Members
Posts: 15
Joined: Wed Apr 23, 2008 8:52 am

Re: Pretty URL - mod_rewrite gives 404

Post by nilson »

Rolf,
mod_rewrite is enabled again.
Not sure what you mean with system info. The server runs on Debian Lenny

Code: Select all

myhost:/var/www/cms_cofis/current# apache2ctl status
Apache Server Status for localhost

Server Version: Apache/2.2.11 (Debian) DAV/2 mod_fastcgi/2.4.6 mod_python/3.3.1
    Python/2.5.4
Server Built: Mar 31 2009 19:14:53
and CMSMS 1.6.6

Do you need anything more from config.php?

Nils
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Pretty URL - mod_rewrite gives 404

Post by Rolf »

With System Information I mean:
Admin >> Site Admin >> System Information >> View Text Report (suitable for copying into forum posts)

®
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
nilson
Forum Members
Forum Members
Posts: 15
Joined: Wed Apr 23, 2008 8:52 am

Re: Pretty URL - mod_rewrite gives 404

Post by nilson »

Ups, here we go:

Code: Select all

----------------------------------------------

Cms Version: [b]1.6.6[/b]

Installed Modules:

    * nuSOAP: [b]1.0.1[/b]
    * CGExtensions: [b]1.8[/b]
    * htmlExport: [b]0.6.2.2b[/b]
    * Album: [b]0.9.3[/b]
    * CMSMailer: [b]1.73.14[/b]
    * FileManager: [b]1.0.1[/b]
    * MenuManager: [b]1.6.2[/b]
    * ModuleManager: [b]1.3.1[/b]
    * News: [b]2.10.3[/b]
    * Printing: [b]1.0.4[/b]
    * Search: [b]1.6.1[/b]
    * ThemeManager: [b]1.1.1[/b]
    * TinyMCE: [b]2.5.5[/b]


Config Information:

    * php_memory_limit: [b][/b]
    * process_whole_template: [b]false[/b]
    * max_upload_size: [b]2000000[/b]
    * default_upload_permission: [b]644[/b]
    * assume_mod_rewrite: [b]true[/b]
    * page_extension: [b].html[/b]
    * internal_pretty_urls: [b]false[/b]
    * use_hierarchy: [b]true[/b]


Php Information:

    * phpversion: [b]5.2.6-3[/b]
    * md5_function: [b]On[/b] (True)
    * gd_version: [b]2[/b]
    * tempnam_function: [b]On[/b] (True)
    * magic_quotes_runtime: [b]Off[/b] (False)
    * memory_limit: [b]128M[/b]
    * max_execution_time: [b]30[/b]
    * safe_mode: [b]Off[/b] (False)
    * session_save_path: [b]/var/lib/php5[/b] (1733)
    * session.use_cookies: [b]On[/b] (True)


Server Information:

    * Server Api: [b]apache2handler[/b]
    * Server Db Type: [b]PostgreSQL (postgres7)[/b]
    * Server Db Version: [b]8.3.5[/b]


----------------------------------------------
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Pretty URL - mod_rewrite gives 404

Post by Rolf »

Okay thx.

What Server Operating System (server_os) do you use? The copy funtion leaves that one out...

®
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
nilson
Forum Members
Forum Members
Posts: 15
Joined: Wed Apr 23, 2008 8:52 am

Re: Pretty URL - mod_rewrite gives 404

Post by nilson »

Debian Lenny with

Code: Select all

~# apache2ctl status
Apache Server Status for localhost

Server Version: Apache/2.2.11 (Debian) DAV/2 mod_fastcgi/2.4.6 mod_python/3.3.1
    Python/2.5.4
Server Built: Mar 31 2009 19:14:53
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Pretty URL - mod_rewrite gives 404

Post by Rolf »

nilson,

I'm afraid this topic is going beyond my knowledge...  :-\
Technical requirements

        * One of these operating systems:
              o Linux/Unix
              o Windows 2000/XP/Vista/Me/2003 (not recommended unless you master it)
              o Mac OS X

        * One of these webservers:
              o Apache 1.3
              o Apache 2
              o IIS 5+
              o LightTPD 1.4+
( http://wiki.cmsmadesimple.org/index.php ... quirements )

It might be possible your server configuration just isn't fit for mod_rewrite, but...  :-\

Perhaps somebody else has a clue?? Russ?

®olf

ps. you can switch mod_rewrite to internal again  ;)
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
nilson
Forum Members
Forum Members
Posts: 15
Joined: Wed Apr 23, 2008 8:52 am

Re: Pretty URL - mod_rewrite gives 404

Post by nilson »

Rolf,
thanks so far.

@all: What would be the relevant lines in the apache.con? I got

Code: Select all

<IfModule mod_rewrite.c>
	RewriteEngine on
</IfModule>
at the end of the file

and mod_rewrite enabled via symlink in

Code: Select all

ls -l /etc/apache/mods-enabled
...
rewrite.conf -> ../mods-available/rewrite.load
...
and

Code: Select all

/usr/lib/apache2/modules/mod_rewrite.so
does exist.

nilson
Golf Gti

Re: Pretty URL - mod_rewrite gives 404

Post by Golf Gti »

Are you sure your host has mod_rewrite enabled?

Some servers will tell you that you have mod_rewrite enable in the phpinfo file.

Create a blank page and call it info.php
Place this

Code: Select all

<? phpinfo(); ?>
and save file to your web server.
Or create a user defined tag and call it phpinfo with

Code: Select all

phpinfo();
and place on a page

Open file and search for mod_rewrite alternatively you will find it under the apache heading; loaded modules.
(note I'm using two hosts with mod_rewrite currently working, one has it listed in the phpinfo, one does not)

I for some reason think the internal pretty url works even if no mod_rewrite exsists. (correct me if Im wrong)
Last edited by Golf Gti on Sat Dec 05, 2009 7:11 am, edited 1 time in total.
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm

Re: Pretty URL - mod_rewrite gives 404

Post by Russ »

Sorry, about the '#RewriteBase /' red herring, I'd completely missed the sub directory. However, you could try removing it and pointing the domain/path in the httpd-vhosts.conf to the subdirectories (cms) root? This is what I do on a Mac which is Debian enough for me ;-)

Secondly in .htaccess I'd add above (RewriteEngine On), if it is not already there.

Code: Select all

Options +FollowSymLinks
I only glanced at the recent posts, but I presume mod_rewrite is running and there are no startup errors for the apache server??
Locked

Return to “CMSMS Core”