Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Reply
mod_rewrite with 2 variables wont work
Old 07-24-2010, 11:35 AM mod_rewrite with 2 variables wont work
Experienced Talker

Posts: 44
Trades: 0
I want to have 2 variables in my RewriteRule, but then the site doesn't work anymore and give me a 500 error

Currently it looks like this, where I've to create these 3 lines for each module

Code:
RewriteRule ^login/style/(.+)$ /module/login/view/stylesheet/$1
RewriteRule ^login/script/(.+)$ /module/login/view/javascript/$1
RewriteRule ^login/image/(.+)$ /module/login/view/image/$1
But I want to change it to something like this


Code:
RewriteRule ^(.+)/style/(.+)$ /module/$1/view/stylesheet/$2
RewriteRule ^(.+)/script/(.+)$ /module/$1/view/javascript/$2
RewriteRule ^(.+)/mage/(.+)$ /module/$1/view/image/$2
The problem might occur because above I've this

Code:
RewriteRule ^style/(.+)$ /view/style/$1
RewriteRule ^image/(.+)$ /view/image/$1
RewriteRule ^script/(.+)$ /view/javascript/$1
My complete .htaccess looks like this

Code:
RewriteEngine On

RewriteRule ^[^\.]+[^/]$ /$0/ [R=301,L]
RewriteRule ^(.+)/$ /index.php?f=$1 [L,QSA]
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php

RewriteRule ^style/(.+)$ /view/style/$1
RewriteRule ^image/(.+)$ /view/image/$1
RewriteRule ^script/(.+)$ /view/javascript/$1

RewriteRule ^login/style/(.+)$ /module/login/view/stylesheet/$1
RewriteRule ^login/script/(.+)$ /module/login/view/javascript/$1
RewriteRule ^login/image/(.+)$ /module/login/view/image/$1

Options -Indexes

ErrorDocument 404 /404/

php_flag magic_quotes_gpc off
Onkel E is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-29-2010, 05:01 AM Re: mod_rewrite with 2 variables wont work
Average Talker

Posts: 24
Name: Justin
Trades: 0
The 500 error is most likely being caused by the php flag in the .htaccess. If your hosting provider is using suPHP, as most do for security, then you cannot use PHP flags and values in .htaccess. Try removing that and see if the error goes away.
__________________

Please login or register to view this content. Registration is FREE
- Premium free cPanel hosting!
justinp is offline
Reply With Quote
View Public Profile Visit justinp's homepage!
 
Old 08-08-2010, 09:15 AM Re: mod_rewrite with 2 variables wont work
Experienced Talker

Posts: 44
Trades: 0
Thanks, that solved it
Onkel E is offline
Reply With Quote
View Public Profile
 
Old 08-08-2010, 01:09 PM Re: mod_rewrite with 2 variables wont work
Experienced Talker

Posts: 44
Trades: 0
Too fast
RewriteRule ^(.+)/(.+)/image/(.+)$ /package/$1/$2/view/image/$3

Is not working, however javascript and stylesheets are - I don't get it
Onkel E is offline
Reply With Quote
View Public Profile
 
Old 08-08-2010, 03:13 PM Re: mod_rewrite with 2 variables wont work
Average Talker

Posts: 24
Name: Justin
Trades: 0
Quote:
Originally Posted by Onkel E View Post
Thanks, that solved it
No problem, so the 500 error is gone, but the rewrites are not working?
__________________

Please login or register to view this content. Registration is FREE
- Premium free cPanel hosting!
justinp is offline
Reply With Quote
View Public Profile Visit justinp's homepage!
 
Old 08-08-2010, 05:06 PM Re: mod_rewrite with 2 variables wont work
Experienced Talker

Posts: 44
Trades: 0
No, for some reason it works with styles and scripts but I still get the error when loading images

500 Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Onkel E is offline
Reply With Quote
View Public Profile
 
Old 08-08-2010, 05:09 PM Re: mod_rewrite with 2 variables wont work
Experienced Talker

Posts: 44
Trades: 0
Log:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

(I'm trying that in a few sec..)

.. Didn't change anything

Last edited by Onkel E; 08-08-2010 at 05:13 PM..
Onkel E is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to mod_rewrite with 2 variables wont work
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.51496 seconds with 12 queries