Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-06-2008, 11:52 PM   PM User | #1
tylerjca
Regular Coder

 
tylerjca's Avatar
 
Join Date: Dec 2002
Location: Canada
Posts: 161
Thanks: 1
Thanked 0 Times in 0 Posts
tylerjca is an unknown quantity at this point
RewriteRule is giving a server error

Hi,
I am trying to do the following:

I have the following code:
Code:
RewriteEngine On
RewriteRule ^p/(A-Za-z0-9]+)$ /index.php?p=$1
However, the code causes the script to halt and gives the following error on page:

Code:
Server Error:
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. 
If you think this is a server error, please contact the webmaster.
I thought maybe ReWrite needed to be enabled in my php.ini file, but I could not find it in the file.
Please help!
Thanks
tylerjca is offline   Reply With Quote
Old 07-07-2008, 12:19 AM   PM User | #2
okram666
New Coder

 
Join Date: Jun 2008
Location: Belgrade
Posts: 19
Thanks: 17
Thanked 0 Times in 0 Posts
okram666 is an unknown quantity at this point
Quote:
Originally Posted by tylerjca View Post
Hi,
...
I have the following code:
Code:
RewriteEngine On
RewriteRule ^p/(A-Za-z0-9]+)$ /index.php?p=$1
...
You have errors in .htaccess

Bad:
Code:
RewriteRule ^p/(A-Za-z0-9]+)$ /index.php?p=$1
Good:
Code:
RewriteRule ^p/([A-Za-z0-9]+)$ index.php?p=$1

Last edited by okram666; 07-07-2008 at 07:27 PM..
okram666 is offline   Reply With Quote
Old 07-07-2008, 12:25 AM   PM User | #3
tylerjca
Regular Coder

 
tylerjca's Avatar
 
Join Date: Dec 2002
Location: Canada
Posts: 161
Thanks: 1
Thanked 0 Times in 0 Posts
tylerjca is an unknown quantity at this point
I tried the change you made, it's still giving me the same error message
tylerjca is offline   Reply With Quote
Old 07-07-2008, 12:40 AM   PM User | #4
okram666
New Coder

 
Join Date: Jun 2008
Location: Belgrade
Posts: 19
Thanks: 17
Thanked 0 Times in 0 Posts
okram666 is an unknown quantity at this point
Quote:
Originally Posted by tylerjca View Post
I tried the change you made, it's still giving me the same error message
If mod_rewrite is enabled than that script should work... I tried it on my server.

Try this just in case...
Code:
RewriteEngine On
Options +FollowSymLinks 

RewriteRule ^p/([A-Za-z0-9]+)$ index.php?p=$1
If this doesn't work than mod_rewrite is disable and you should contact hosting support
okram666 is offline   Reply With Quote
Old 07-07-2008, 02:11 AM   PM User | #5
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by tylerjca View Post
Hi,
However, the code causes the script to halt and gives the following error on page:

Code:
Server Error:
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. 
If you think this is a server error, please contact the webmaster.
I thought maybe ReWrite needed to be enabled in my php.ini file, but I could not find it in the file.
Please help!
Thanks
rewrite have nothing to do with php and with php.ini.
your problem could be the code from index.php and/or permision rights.
check index.php first.

PS: okram666 have right, could be also errors in .htaccess.

regards
oesxyl is offline   Reply With Quote
Old 07-13-2008, 05:58 PM   PM User | #6
tylerjca
Regular Coder

 
tylerjca's Avatar
 
Join Date: Dec 2002
Location: Canada
Posts: 161
Thanks: 1
Thanked 0 Times in 0 Posts
tylerjca is an unknown quantity at this point
Quote:
Originally Posted by okram666 View Post
If this doesn't work than mod_rewrite is disable and you should contact hosting support
How do I find out if mod_reqrite is enabled? By the way, I'm using XAMPP as the server. I know the rewrite functions work on my dotcom web site, just not on the test server at home.


I tried this:
Quote:
Originally Posted by okram666 View Post
Code:
RewriteEngine On
Options +FollowSymLinks 

RewriteRule ^p/([A-Za-z0-9]+)$ index.php?p=$1
But it still gave me the same error, so I'm assuming mod_rewrite is disabled as you said?

Last edited by tylerjca; 07-13-2008 at 06:02 PM..
tylerjca is offline   Reply With Quote
Old 07-14-2008, 11:20 AM   PM User | #7
okram666
New Coder

 
Join Date: Jun 2008
Location: Belgrade
Posts: 19
Thanks: 17
Thanked 0 Times in 0 Posts
okram666 is an unknown quantity at this point
Quote:
Originally Posted by tylerjca View Post
How do I find out if mod_reqrite is enabled? By the way, I'm using XAMPP as the server. I know the rewrite functions work on my dotcom web site, just not on the test server at home.
...
I found these two tutorials for enabling mod_rewrite on XAMPP...

http://rudyegenias.wordpress.com/200...rite-in-xampp/

http://roshanbh.com.np/2008/04/check...te-apache.html
okram666 is offline   Reply With Quote
Old 07-14-2008, 09:37 PM   PM User | #8
ohgod
Regular Coder

 
ohgod's Avatar
 
Join Date: Jun 2008
Location: Ohio
Posts: 579
Thanks: 6
Thanked 69 Times in 69 Posts
ohgod is on a distinguished road
you load modules in httpd.conf

find it, open it and you'll see examples via modules called by the default installation
ohgod is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:33 AM.


Advertisement
Log in to turn off these ads.