Htaccess Rewriterule 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 rewriteengine on 500 internal server error About Us Learn more about Stack Overflow the company Business Learn more
Htaccess Redirect 500 Internal Server Error
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss invalid command rewriteengine 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 htaccess Rewrite Rule
Apache2 Enable Mod_rewrite
- Internal Server Error up vote 0 down vote favorite I am having problems getting what I think should be a simple htaccess rewrite to work... Current URL: http://www.website.com/profile.php?id=61338848 Desired URL: http://www.website.com/61338848 Current htaccess code: RewriteEngine On RewriteRule ^([^/]*)$ /profile.php?id=$1 [L] Result from the above htaccess is INTERNAL SERVER ERROR: I would also like it to work for a custom domain (if set) although I htaccess rewrite rule am sure the solution priovided for the above will work just as well. Desired URL: http://www.website.com/customdomain Thanks in advance. php .htaccess url mod-rewrite share|improve this question edited May 6 '14 at 10:57 Jenz 6,54351742 asked May 6 '14 at 10:56 Peter Bennett 708 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted i used this .htaccess and it works for me: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)$ profile.php?id=$1 [L,QSA] The QSA flag is used, that you can add multiple get parameters like this: http://www.website.com/61338848?parameter=value RewriteCond %{REQUEST_FILENAME} !-f checks if the request_filename is a file, if yes, the RewriteRule will not be executed share|improve this answer edited May 6 '14 at 11:20 answered May 6 '14 at 11:14 Dinistro 1,9201021 perfect, I don't know if you edited it but this works perfectly. Thanks! –Peter Bennett May 6 '14 at 11:19 Yes, I just edited it –Dinistro May 6 '14 at 11:20 add a comment| up vote 1 down vote Try to remove the / before the filename, like: RewriteRule ^([^/]*)$ profile.php?id=$1 [L] It worked for me. share|improve this
here for a quick overview of the site Help Center Detailed answers to any questions you
Rewritebase
might have Meta Discuss the workings and policies of this site
Apache Rewrite Rules
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 http://stackoverflow.com/questions/23492784/htaccess-rewrite-rule-internal-server-error million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up 500 Internal Server Error when using .htaccess with RewriteEngine up vote 21 down vote favorite 5 I am on the shared host Bounceweb and I am trying to add some rewrite rules to make my links look http://stackoverflow.com/questions/5373334/500-internal-server-error-when-using-htaccess-with-rewriteengine prettier. One of these rules is to make the url: http://mysite.com/upload point to: http://mysite.com/upload.php. I have this in my .htaccess file: RewriteEngine on RewriteRule ^upload$ upload.php but all it's giving me is a 500 Internal Server Error. I looked at my logs and this comes up a lot: [alert] [client 81.179.29.185] /home/minecraf/public_html/.htaccess: Invalid command '\xef\xbb\xbfRewriteEngine', perhaps misspelled or defined by a module not included in the server configuration Does this mean my host doesn't support .htaccess? Pretty lame if they don't. I've already tried changing the permissions of .htaccess to 777 and it doesn't help. Thanks! .htaccess mod-rewrite share|improve this question asked Mar 21 '11 at 2:46 Josh 46641232 add a comment| 6 Answers 6 active oldest votes up vote 28 down vote accepted \xef\xbb\xbf are three invisible junk characters (at least from Apache's perspective) called the Unicode BOM, or byte order mark. Apache thinks that those characters are part of the command that follows right after. This is what you s
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and http://stackoverflow.com/questions/25568169/htaccess-rewrite-url-gives-500-internal-server-error policies of this site About Us Learn more about Stack Overflow the http://webmasters.stackexchange.com/questions/24927/htaccess-mod-rewrite-500-internal-server-error 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 internal server 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 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 internal server error / 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 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
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 Business Learn more about hiring developers or posting ads with us Webmasters Questions Tags Users Badges Unanswered Ask Question _ Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top .htaccess mod_rewrite 500 internal server error up vote 2 down vote favorite Whenever I place my .htaccess file in my web directory I receive a 500 internal server error and within the error.log file specifying: [Sat Jan 21 13:46:07 2012] [error] [client xx.xx.xxx.xx] 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. My .htaccess file: RewriteEngine On RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !(\.png|\.jpg|\.gif|\.jpeg|\.bmp|\.css|\.js)$ RewriteRule ^(.*) index.php I have tried enabling Options +FollowSymLinks but this has been fruitless. Everything works locally. Any pointers as to what I could be doing wrong? php htaccess mod-rewrite http-code-500 error-reporting share|improve this question edited Mar 8 '13 at 12:28 Simon Hayter♦ 21.4k43279 asked Jan 21 '12 at 13:04 Bart Zweers migrated from stackoverflow.com Jan 23 '12 at 3:38 This question came from our site for professional and enthusiast programmers. You can't use two %{} parameters in a single RewriteCond.. use REQUEST_URI for your rule above –yoavmatchulsky Jan 21 '12 at 13:24 2 this is not true, you can use multiple %{} parameters, this will look for the regex in the concatenated string –Yaron Uliel Jan 21 '12 at 13:28 @YaronUliel that's a first for me. thanks :) –yoavmatchulsky Jan 21 '12 at 13:34 1 @yoavmatchulsky בכיף :) –Yaron Uliel Jan 21 '12 at 13:39 add a comment| 3 Answers 3 active oldest votes up vote 1 down vote accepted Change your code with this: Options +FollowSy