500 Internal Server Error

New to mod_rewrite? This is a good place to start.

500 Internal Server Error

Postby wxwx » Wed Oct 07, 2009 6:21 am

Hi

Today I changed to new hosting and getting the 500 internet server on my htaccess. Just weird because my previous hosting working fine.

Error this line

Code: Select all
[Wed Oct  7 21:43:52 2009] [alert] [client xx.xx.xx.xx] /home/xx/domains/xx/public_html/.htaccess: RewriteRule: cannot compile regular expression '^category/([0-9]+)(?:/([^/]+)(?:/([^/]+))?)?/$'\n


the .htaccess

Code: Select all
RewriteRule ^category/([0-9]+)(?:/([^/]+)(?:/([^/]+))?)?/$ ./category.php?pid=$1&catname=$2&spage=$3 [QSA,L]


May i know what the problem exactly?
wxwx
 
Posts: 8
Joined: Tue May 12, 2009 4:42 pm

Postby richardk » Wed Oct 07, 2009 11:50 am

You can't use ?: (your Apache's version of the regular expression library does not support it).
Code: Select all
RewriteRule ^category/([0-9]+)(/([^/]+)(/([^/]+))?)?/?$ ./category.php?pid=$1&catname=$3&spage=$5 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby wxwx » Thu Oct 08, 2009 1:27 am

richardk wrote:You can't use ?: (your Apache's version of the regular expression library does not support it).
Code: Select all
RewriteRule ^category/([0-9]+)(/([^/]+)(/([^/]+))?)?/?$ ./category.php?pid=$1&catname=$3&spage=$5 [QSA,L]


thanks richardk. now working.. 8)
wxwx
 
Posts: 8
Joined: Tue May 12, 2009 4:42 pm

Removing (.php) file extensions

Postby rudiq » Fri Nov 13, 2009 2:11 am

Hi,
I have this problem:
For remove php extension I use this code in .htaccess (from FAQ - With a trailing slash):
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Redirect to remove /index.php files.
RewriteCond %{THE_REQUEST} \ /(.+/)?index\.php(\?.*)?\  [NC]
RewriteRule ^(.+/)?index\.php$ /%1 [NC,R=301,L]

# Redirect to remove .php
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{SCRIPT_FILENAME} -f
RewriteCond %{REQUEST_URI} ^(/.+)\.php$
RewriteRule ^(.+)\.php$ %1/ [R=301,L]

# Rewrite to add .php back.
RewriteCond %{REQUEST_URI} ^(/.+)/$
RewriteCond %{DOCUMENT_ROOT}%1.php -f
RewriteRule ^.+/$ %1.php [QSA,L]


Everything works fine on my test server but when I put .htaccess on my webhosting 500 Internal Server Error occured. When I remove this line:
Code: Select all
Options +FollowSymLinks
rewriting is OK but pages can't load external stylesheet, images etc.

What can I do?
Please Help.

[edit]
I must be blind :o here is solution ( relative paths ) :
viewtopic.php?p=10709#10709

Best regards
Rudiq
rudiq
 
Posts: 1
Joined: Fri Nov 13, 2009 1:21 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 5 guests

cron