FreePgs.com Forum

FreePgs Related => Support Requests => Topic started by: styx on March 03, 2007, 02:58:15 PM

Title: htaccess -> mod_rewrite doesnt work
Post by: styx on March 03, 2007, 02:58:15 PM
Hey,

I am new to mod_rewriting, so I read some guides. The I tested a very simple one:
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]


But it doesn't work at all?

They say I normally have to add this line in front:
Options +FollowSymlinks
But options is disabled on this host, so I removed it.

The script just doesn't do what I want :/, while I followed the guide correctly (link to guide: here (http://corz.org/serv/tricks/htaccess2.php)).

Can you please help me out?
Title: Re: htaccess -> mod_rewrite doesnt work
Post by: brainiac744 on March 04, 2007, 03:49:03 AM
When you say that it doesn't work at all, are you getting a 500 internal server error when that is in the .htaccess, or is there another problem?
Title: Re: htaccess -> mod_rewrite doesnt work
Post by: styx on March 04, 2007, 11:25:50 AM
Quote from: brainiac744 on March 04, 2007, 03:49:03 AM
When you say that it doesn't work at all, are you getting a 500 internal server error when that is in the .htaccess, or is there another problem?

If I add the Options line in it, I get a 500 ... but else it just doesn't do anything. If I got to an HTML-page, it doesn't show the PHP one :/.
Title: Re: htaccess -> mod_rewrite doesnt work
Post by: brainiac744 on March 05, 2007, 02:52:48 AM
Do you get a 404 error then?

Notice that rule is only going to rewrite .htm files to .php files, not .html ones, so be sure that you're trying a filename that will be rewritten.

Otherwise you'll have to wait for somebody who knows a bit more about mod_rewrite than me, because I don't see an error in that code.
Title: Re: htaccess -> mod_rewrite doesnt work
Post by: styx on March 05, 2007, 03:44:48 PM
Of course I used a HTML-file ;).
If I try to go to index.php it will give an error, and index.htm just shows normal, with the htm-extension :/.
Title: Re: htaccess -> mod_rewrite doesnt work
Post by: admin on March 08, 2007, 05:03:34 AM
Please provide your URL or account username for further assistance.

(You can also use the Contact Form to provide this information to us)

Thank you,
FreePgs.com Admin
Title: Re: htaccess -> mod_rewrite doesnt work
Post by: styx on March 08, 2007, 08:30:17 PM
Hey,

Thanks for your response :). I will use the contact form for this problem ;).
Title: Re: htaccess -> mod_rewrite doesnt work
Post by: admin on March 08, 2007, 10:55:07 PM
I created the .htaccess file and it seems to work (it does what the rules tell it to do)

Note the following exceptions:

The flag should be [NC] not [nc].  (Please note that these two values are completely different)

The proper file would be (based on your original file)

RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [NC]

In the contact request you stated .html but here you wrote .htm, I am not sure which you intend to use.  The file created in your account uses .html

If you intend to also have .html files in your account, you will need to use RewriteCond to setup a condition to not rewrite if the file exists.  Otherwise, you should be fine.

The Options directive does not need to be included as that option is already set on this system.

Thank you,
FreePgs.com Admin