Problem with mod_rewrite and pretty url

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.
cmaunoury
Forum Members
Forum Members
Posts: 36
Joined: Sun Jul 19, 2009 9:52 pm

Problem with mod_rewrite and pretty url

Post by cmaunoury »

Hi all,

I have a ISS server with php 5 and myql5.

I want to enable pretty url and to do so I have followed the course described here: http://wiki.cmsmadesimple.org/index.php/FAQ/Installation/Pretty_URLs#Pretty_URL.27s

My installation of CMSMS is the "public" folder of my server. I place the .htaccess in this directory, along with the config file.

Here is my website (in construction): http://www.firasproject.com/public/

When I click on one of the menus, it looks for the "prettied" url allright (such as .../public/filmmakers/) but I end up with a 404 error on all the menus.

I have tried enabling the .htm extension and without as well. I have tried to rename my pages with the extension. None of this worked. I have enabled the custom 404 handling in Site Admin -> Global Settings to see if the 404 page that was returned to me was the one with my template but it doesn't seem to be.

Any idea what it could be?

Thanks,

Colin
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: Problem with mod_rewrite and pretty url

Post by tyman00 »

.htaccess is an Apache thing not IIS, therefore pretty urls will not work. You will have to work with internal pretty urls.
Last edited by tyman00 on Thu Jul 23, 2009 11:49 pm, edited 1 time in total.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
cmaunoury
Forum Members
Forum Members
Posts: 36
Joined: Sun Jul 19, 2009 9:52 pm

Re: Problem with mod_rewrite and pretty url

Post by cmaunoury »

Aaaah.
So I got everything upside down. I thought it was the contrary and that internal pretty url would not work in IIS...

This phrase in the handbook is to be truthful a bit obscure:
The internal mechanism is handled entirely within PHP and doesn't require mod_rewrite in Apache. However, it won't work on IIS, and if you do enable it, you must also ensure that your template contains a {metadata} tag. To enable it, set this option to true:
So I cancelled all my .htaccess, set my config.php as follows:
$config['url_rewriting'] = 'internal';
$config['page_extension'] = '';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
And it still does not work: http://www.firasproject.com/public/ If you try the menu, it does not work...
What is it that I missed? I hope it is not my server configuration that makes it like that...Oh I hate this IIS server!

Thanks for your help,

Colin
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: Problem with mod_rewrite and pretty url

Post by tyman00 »

Hmm... I may have given you false information then. But I really thought internal would work on IIS because it doesn't rely on Apache stuff to do it. I know for sure the regular pretty urls will not work on IIS with the htaccess method.

I will try to test on my IIS test machine that I use for Beta testing CMSMS on the IIS platform to see if I can accomplish it. However, since I use it only once and awhile it is not powered on, I'll try to do it this weekend.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
cmaunoury
Forum Members
Forum Members
Posts: 36
Joined: Sun Jul 19, 2009 9:52 pm

Re: Problem with mod_rewrite and pretty url

Post by cmaunoury »

Thank you so much...
My host makes it possible to migrate to a Linux / Apache Server.

I have run into so many problems with this IIS one that maybe I should do that right now, before my site gets further implemented...

How about that?

Best,

Colin
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: Problem with mod_rewrite and pretty url

Post by tyman00 »

+1    8)
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
Pierre M.

Re: Problem with mod_rewrite and pretty url

Post by Pierre M. »

Hello Colin,

can I ask what has made the non-unix Internet hosting decision ?

Pierre M.
cmaunoury
Forum Members
Forum Members
Posts: 36
Joined: Sun Jul 19, 2009 9:52 pm

Re: Problem with mod_rewrite and pretty url

Post by cmaunoury »

Of course, you can ask. It brings me great pain to answer. It was ignorance!

The person for whom I am doing the website and to whom I said "use CMS" had already gotten the server before, and I arrived too late.

Alas! But I thought I would manage anyways...

I guess tyman's experiments could be of interest to anyone (or at least the little part of everyone that has an IIS server), though.

Thanks to all
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: Problem with mod_rewrite and pretty url

Post by tyman00 »

I highly recommend running from the IIS server as fast as you can, but I will still test just to make sure and I will update the wiki with the proper information when I have my findings.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
cmaunoury
Forum Members
Forum Members
Posts: 36
Joined: Sun Jul 19, 2009 9:52 pm

Re: Problem with mod_rewrite and pretty url

Post by cmaunoury »

Thanks for everything.
So I have moved my website to an Apache server (php 5.3 / same mysql 5 / installed CMSMS 1.6.1) now and I am back to where I was before (in terms of content/template/stylesheet, etc.)

Although I feel I am getting closer, I can't get pretty_url to work. I am sure I missed a step, or maybe I just read to many different handbooks and wikis and forum threads and I got confused. So here is what I am doing, step by step:

I have changed my config.php doc which is on the root of my website to the following:
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.hml';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
I have created a text document (in Apple TextEdit) named htaccess.rtf, which I uploaded on my server in ASCII and renamed .htaccess
It contains the following:
Options +FollowSymLinks
 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 ^(.+).html$ index.php?page=$1 [QSA]
When I try to navigate on my website, I get a 500 internal error on any page, including the admin area...

here is the website (but I'll turn off the mod_rewrite for sometime so as to be able to work on other parts): www.firasproject.com

I would like to turn on the pretty url in great part to be able to display CGBlog Summary on my homepage with a link to my "Blog"
area that displays the detail of the posts. I don't think there is any way to do that without pretty url...

In any case, it should work and it is obviously an error of mine, but after having tried many different things (without .html in both config.php and htaccess for instance, with .php and .htm instead of .html...)

EDIT: oh yes, I have the {metadata} tag in each of my template's headers and the Global Settings -> Metadata reads:

I don't know what to do...

THanks for your help!

Colin
Last edited by cmaunoury on Sat Jul 25, 2009 7:33 pm, edited 1 time in total.
Pierre M.

Re: Problem with mod_rewrite and pretty url

Post by Pierre M. »

Hello again,

what about the (1.6.1 packaged in /doc) provided sample :
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
instead of your (.+).html thing whom I'd rather write (.+)\.html ?
Or maybe
RewriteRule ^(.+)\.html$ index.php?page=$1 [QSA] but I don't thing it is needed
If in doubt use a RewriteLog.

Pierre M.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Problem with mod_rewrite and pretty url

Post by Dr.CSS »

For a more up to date htaccess look in the unpacked 1.6 root/doc folder...
cmaunoury
Forum Members
Forum Members
Posts: 36
Joined: Sun Jul 19, 2009 9:52 pm

Re: Problem with mod_rewrite and pretty url

Post by cmaunoury »

Well, if I do that in my config.php:
$config['url_rewriting'] = 'internal';
$config['page_extension'] = '/';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
it works, but I am not too fond of the internal pretty url format.

If I follow your last advices, which are if I am not mistaken, to modify my config.php like that:

$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.html';
$config['use_hierarchy'] = true;
com/index.php?page=somecontent)
$config['query_var'] = 'page';
upload it, move the htaccess.txt document that is in my /doc/ director to my root directory and rename it .htaccess, I should have the pretty url working fine right?

If I do that, I still have the 500 internal error...

I guess it might be a php config error. Any idea which part it would be? I have access to my php.config.ini file from my hoster, but I am not too knowledgeable in this area and I don't really want to mess up with that...

I am bound to use the internal pretty url?

Thanks for your follow up and your help!

Colin
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Problem with mod_rewrite and pretty url

Post by Dr.CSS »

If you did the config.php as shown in the second quote and used the htaccess from the doc folder of your install and it doesn't work you have some kind of server issue...

Do you have any yellow ! or red X in system info page?...
cmaunoury
Forum Members
Forum Members
Posts: 36
Joined: Sun Jul 19, 2009 9:52 pm

Re: Problem with mod_rewrite and pretty url

Post by cmaunoury »

Well, this is with a yellow exclamation mark:

disable_functions in PHP (disable_functions):
system, popen, dl, passthru, proc_open, shell_exec

and I have my config.php that is still writable (that is easily changeable, but I guess it is more a security issue, right?)

As for the PHP function disabled I can change that in my php.ini file?

I must say I rather freak out when I have to touch to that... but if you tell me what to do, I would feel ok :)

Thanks for your continued help, I really appreciate!

Colin
Post Reply

Return to “CMSMS Core”