Htaccess Redirect Internal Server Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company
Htaccess Redirect 500 Internal Server Error
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions rewriteengine on 500 internal server error Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million redirect 500 error htaccess programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Htaccess rewrite url gives 500 Internal server error up vote 1 down vote favorite I am getting 500 Error internal with
Htaccess Rewrite Rule
following code : RewriteEngine On RewriteRule ^([^/]*)$ /get.php?action=$1 [L] The rewrite module is Active , Safe mode is OFF and there is no problem, I tested this code : Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / But nothing changed. What to do now ? php apache .htaccess mod-rewrite share|improve this question edited Aug 29 '14 at 12:30 Ali Khanusiya 1,734727 asked Aug 29 '14 at 12:19 Pafo 55110 What does your log
Rewritebase
says? –rahilwazir Aug 29 '14 at 12:23 @RahilWazir No log found. –Pafo Aug 29 '14 at 12:24 add a comment| 1 Answer 1 active oldest votes up vote 4 down vote accepted It looks to me the issue is that you're not setting any limits, so it loop's your redirect. Here is an example that would stop since the file get.php exists. Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]*)$ /get.php?action=$1 [L] To further explain, what happens in your example is that it redirects to get.php over and over and over, because your rule tells anything not a / to internally redirect but not to stop if a file exits, and since get.php also falls under your regex expression, it would redirect again. What the 2 conditions I have added does is, it tells it to stop if a file or folder exists. If you're using HTTPD version 2.4+ you could have simple used the flag [END], like this: RewriteRule ^([^/]*)$ /get.php?action=$1 [END] Which tells the server to stop any further redirects. share|improve this answer edited Aug 29 '14 at 12:32 rahilwazir 6,575112442 answered Aug 29 '14 at 12:25 Prix 14.1k939100 WOW, IT fixed :D Tnx alot. –Pafo Aug 29 '14 at 12:29 2 +1 for
here for a quick overview of the site Help Center Detailed answers to any questions you might apache enable mod_rewrite have Meta Discuss the workings and policies of this site About
Htaccess 301 Redirect
Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads apache rewrite rules with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million http://stackoverflow.com/questions/25568169/htaccess-rewrite-url-gives-500-internal-server-error programmers, just like you, helping each other. Join them; it only takes a minute: Sign up htaccess redirection causing 500 error up vote 2 down vote favorite I would like to redirect users from this link: http://mySite/myFolder/user/userName or this one http://www.mySite/myFolder/user/userName to this : http://mySite/myFolder/members/userName Using .htaccess so I added this line to the end http://stackoverflow.com/questions/20972277/htaccess-redirection-causing-500-error of the file : Redirect 301 %{DOCUMENT_ROOT}/fikra/user/$1 %{DOCUMENT_ROOT}/members/$1 I had 500 error on the server . I tried also this : Redirect 301 ^(.*)/myFolder/user/$1 http://mySite/members/$1 And it doesn't work. I would like to fix this error :-) apache .htaccess redirect share|improve this question edited Nov 13 '15 at 0:24 pnuts 33.9k63769 asked Jan 7 '14 at 12:59 4m1nh4j1 1,12442154 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted use this: RewriteRule myFolder/user/(.*) http://example.com/members/$1 [R=301,L,NC] share|improve this answer answered Jan 7 '14 at 13:06 Amine Hajyoussef 3,54721020 Thanks, can you please explain L and NC ? –4m1nh4j1 Jan 7 '14 at 13:24 They are flags (docs). L causes this round of rewriting to stop (often done for optimization and stopping multiple rules doing conflicting things). NC makes the rule case-insensitive. –Sumurai8 Jan 7 '14 at 13:28 Start the match pattern with ^ (RewriteRule ^myFolder...) so that a URI such as /glotz/myFolder/... won't match
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this http://stackoverflow.com/questions/17107940/rewriterule-creating-500-internal-server-error site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up RewriteRule internal server creating 500 Internal Server Error up vote 4 down vote favorite I have the following in my .htaccess file: Options +FollowSymLinks RewriteEngine on RewriteRule ^directory/(.*)$ directory/index.php?id=$1 What I'm trying to achieve is this: When the URL www.mydomain.com/directory/10 is visited, the page www.mydomain.com/directory/?id=10 is displayed on the browser without altering the appearance of the URL. The above code creates a 500 Internal server error though. internal server error Does anyone know where I'm going wrong? php apache .htaccess mod-rewrite share|improve this question asked Jun 14 '13 at 11:56 Tom 4,3042697174 1 A 500 error generally means an error has been logged somewhere. Find your Apache and PHP error logs, and see what the actual error is. –IMSoP Jun 14 '13 at 11:58 4 The 500 error delivered to the browser should have informed you that the full error message would be in the server logs. Read them. –Quentin Jun 14 '13 at 11:58 add a comment| 4 Answers 4 active oldest votes up vote 9 down vote accepted Your code is guaranteed to generate 500 internal server error because it is causing infinite looping. Reason is that your matching URI pattern is: ^directory/(.*)$ Which matches your URLs before and after rewrites. And once it reaches max allowed internal rewrite limit Apache throws 500 internal server error and bails out. Change your code to this: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^directory/(.*)$ /directory/index.php?id=$1 [L,QSA,NC] Above code has an extra RewriteCond %{REQUEST_FILENAME} !-f that will make sure to