Htaccess 301 Redirect 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 htaccess redirect 500 internal server error of this site About Us Learn more about Stack Overflow the company
Redirect 500 Error Htaccess
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Redirect 301 Htaccess
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 Redirect 301 in .htaccess causes 500 server error (Redirect to non-URL) up vote 6 down vote favorite 1 have such kind of error. When adding Redirect 301 rule to .htaccess file like: Redirect 301 "/page1.html" "/dir1/" My site fails with 500 server error and in apache error log this error appears: [Wed Mar 16 11:08:52 2011] [alert] [client 127.0.0.1] /home/htdocs/site.com/www/.htaccess: Redirect to non-URL Mod rewrite is installed, also tried to provide urls without quotes. On production server this .htaccess works fine, but on local causes troubles Any ideas, please) This rule works Redirect 301 "/page1.html" "http://www.site.com/dir1/" but I need a way to supply relative paths instead of full urls (production server works that way) .htaccess apache2 share|improve this question edited Apr 7 '11 at 10:31 asked Mar 16 '11 at 9:54 Dmitry Evseev 9,06132441 add a comment| 3 Answers 3 active oldest votes up vote 5 down vote accepted Changed all Redirect 301 rules to: RewriteRule ^/page1.html$ /dir1/page.html [R=301,L] now working. But how does it work on production? share|improve this answer answered Apr 7 '11 at 10:31 Dmitry Evseev 9,06132441 add a comment| up vote 1 down vote For me, I had the exact same issue. Adding "http://domain.com" in front of "/mypage" worked; I am still testing to get it to work without, as is does on my production server. So my .htaccess on my local testing environment, went like this: BROKEN: Redirect 301 /mypage /directory1/sub-directory/mypage/ FIXED: Redirect 301 http://mydomain.com/mypage http://mydomain.com/directory1/sub-directory/mypage/ share|improve
SEO with marketing resources for all skill levels: best practices, industry survey results, webinarsandmore. Advance your marketing skills: Local Marketing | Content | Social Media Get started with: The Beginner's Guide to SEO The Local Learning Center The Beginner's Guide to ContentMarketing Q&A Get answers from the Moz Community Help Hub Learn how to use Moz Products Community & Events Connect with 500K online marketers Blogs Read the Moz Blog and YouMoz The Moz Q&A Forum Questions Search/Browse Ask the Community Hey friend! Have fun exploring Q&A, but in order to ask your own questions, comment, or give thumbs up, you need to be logged http://stackoverflow.com/questions/5323557/redirect-301-in-htaccess-causes-500-server-error-redirect-to-non-url in to your Moz Pro account. You can also earn access by receiving 500 MozPoints from participating in YouMoz and the Moz Blog! How does Q&A work? Have a Question? Browse Questions View All Questions Bounty New (No Responses) Discussion Answered Product Support Unanswered From All Time Last 30 Days Last 7 Days Last 24 Hours Sorted by Latest Questions Recent Activity Most Thumbs Up Most Responses Fewest https://moz.com/community/q/can-an-incorrect-301-redirect-or-htaccess-code-cause-500-errors Responses Oldest Questions With category All Categories Affiliate Marketing Alternative Search Sources Analytics Behavior & Demographics Branding / Brand Awareness Competitive Research Consulting Tips & Trends Content & Blogging Conversion Rate Optimization Educational Resources Email Marketing Entrepreneurship Inbound Marketing Events Inbound Marketing in the Media Inbound Marketing Industry Intermediate & Advanced SEO International Issues Internet Advertising Interviews Keyword Research Legal Link Building Local Listings Local Strategy Local Website Optimization Management / Culture Mobile and Local Moz News Moz Tools On-Page / Site Optimization Online Marketing Tools Paid Search Marketing PRO Application Reporting Reputation Management Reviews and Ratings Search Engine Trends Social Media Social Media for Local Search Support - Account Help Support - Feature Requests Support - Followerwonk Support - Getting Started Support - Moz Analytics: Brand & Mentions Support - Moz Analytics: Links Support - Moz Analytics: Search Support - Moz Analytics: Social Support - Moz APIs Support - Moz Local Support - Open Site Explorer Support - Other Research Tools Support - Settings Help Technical SEO Issues Testing / Quality Assurance Vertical SEO: Video, Image, Local Web Design White Hat / Black Hat SEO Whiteboard Friday Browse Category Moz Resources PRO Application Moz Tools Moz News Help wi
301 /products/tech.html /products/technology.html It doesn't matter if I used the absolute URL or not for the new destination. sparek 2008-10-23 18:53:34 UTC #2 You say that you are inserting https://www.sitepoint.com/community/t/301-re-directs-in-htaccess-cause-internal-server-errror-500/4359 a handful. What happens if you just insert one? You may have a syntax error in one of the lines that you are inserting. You can also check the Apache error log for more http://www.htaccessredirect.net/ information. mgm_03 2008-10-23 19:06:24 UTC #3 When I only use one, I get the same result. sparek 2008-10-23 19:12:38 UTC #4 What does the Apache error log show when you encounter this error? SariJ server error 2008-10-24 03:02:36 UTC #5 Is RewriteEngine kept On and hope the .htaccess is enabled via the apache conf with the AllowOverride All variable? SergHZ 2008-10-24 06:45:48 UTC #6 Make sure that Apache is compiled with mod_rewrite module on your server. Otherwise you will get an Internal Server error when you use rewrite rules. dklynn 2008-10-25 05:58:28 UTC #7 HZ: Really? Redirect is mod_alias (Apache core) and mod_rewrite has htaccess 301 redirect NOTHING to do with it! PLEASE don't scare me like this - I have my (VPS) account there! mgm: I suspect that sparek is correct - that you have a syntax error in your Redirect statement(s) http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect said: Redirect Directive Description: Sends an external redirect asking the client to fetch a different URLSyntax: Redirect [status] URL-path URLContext: server config, virtual host, directory, .htaccessOverride: FileInfoStatus: BaseModule: mod_alias The Redirect directive maps an old URL into a new one by asking the client to refetch the resource at the new location. The old URL-path is a case-sensitive (%-decoded) path beginning with a slash. A relative path is not allowed. The new URL should be an absolute URL beginning with a scheme and hostname.Example: Redirect /service http://foo2.bar.com/service If the client requests http://myserver/service/foo.txt, it will be told to access http://foo2.bar.com/service/foo.txt instead. Note Redirect directives take precedence over Alias and ScriptAlias directives, irrespective of their ordering in the configuration file. Also, URL-path must be a fully qualified URL, not a relative path, even when used with .htaccess files or inside of
ConverterOnline Diff ToolHTML Entities EscapeMD5 Hash GeneratorSHA-1 Hash GeneratorURL Encode/Decode Formatters CSS FormatterGO FormatterHTML FormatterJavascript FormatterJavascript ObfuscateJSON FormatterJSON EditorJSON ValidatorPerl FormatterPHP FormatterPython FormatterRuby FormatterSQL FormatterXML Formatter Images Favicon.ico & App Icon GeneratorOnline Image EditorCSS Sprite Generator Internet CSS Property ReferenceEmail ValidatorIs It Up Or DownDefault Router SettingsWhat is my IP Minifiers CSS MinifyJavascript MinifyJSON Minify SEO Adblock Monitor & NotificationKeyword ToolPagerank Checker Related: CSS FontsColor Picker Tweet Follow @danstools00 All .htaccess Options Rewrite to www 301 Redirect File or Directory Caching Javascript, CSS, and Images Password protect file (requires .htpasswd file) htpasswd generator Prevent Hotlinking Custom Error Pages (400, 404, 500, etc) Block or Allow an IP Block bots Change default directory page Prevent viewing of .htaccess file Prevent Directory Listing Rewrite to www More info about .htaccess Redirect to WWW Domain Name Redirects example.com to www.example.com 301 Redirect File or Directory More info about .htaccess Redirect File or Directory Old File Path New File Path Old Directory Path New Directory Path Caching Javascript, CSS, and Images File Extensions Comma separated list. Omit leading "." Cache Duration Minutes Hours Days Weeks Months Public Private Must Revalidate Password protect file (requires .htpasswd file) More info about .htaccess and .htpasswd Protection File Name .htpasswd File Path htpasswd Generator More info about .htpasswd File Username Password Prevent Hotlinking More info about .htaccess Prevent Hotlink Referring URL The domain that is hotlinking to you. File Extension Comma separated list. Omit leading "." No hotlinking Image Optional. What to show instead of the intended image. Custom Error Pages (400, 404, 500, etc) More info about .htaccess Custom Error Page 400 Error file path Bad Request 401 Error file path Auth Required 403 Error file path Forbidden 404 Error file path Not Found 500 Error file path Internal Server Error Block or Allow an IP More info about .htaccess Block and Allow IP Block these IPs Comma separated list Allow these IPs Comma separated list Block bots More info about .htaccess Block Unwanted Bots by Useragent Enable Change default directory page More info about .htaccess Change Default Dir Directory Page Prevent viewing of .htaccess file More info about Block access to .htaccess Enable Prevent Directory Listing More info about .htaccess Block Directory Listing Enable G