Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder tylerjca's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    161
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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

  • #2
    New Coder
    Join Date
    Jun 2008
    Location
    Belgrade
    Posts
    19
    Thanks
    17
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Regular Coder tylerjca's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    161
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I tried the change you made, it's still giving me the same error message

  • #4
    New Coder
    Join Date
    Jun 2008
    Location
    Belgrade
    Posts
    19
    Thanks
    17
    Thanked 0 Times in 0 Posts
    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

  • #5
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    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

  • #6
    Regular Coder tylerjca's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    161
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #7
    New Coder
    Join Date
    Jun 2008
    Location
    Belgrade
    Posts
    19
    Thanks
    17
    Thanked 0 Times in 0 Posts
    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

  • #8
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts
    you load modules in httpd.conf

    find it, open it and you'll see examples via modules called by the default installation


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •