hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Apache rewrite issue makes no sense. Help?
Reply

Forum Jump

Apache rewrite issue makes no sense. Help?

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old
New Member
 
Join Date: Nov 2012
Posts: 1

Apache rewrite issue makes no sense. Help?


Hi all!!

This one has me stumped.

I'm trying to do a 301 redirect of some old pages to new ones.

They work perfectly fine without the R flag, but if I add any kind of [R] or [R=301] they break.

Works:

RewriteRule test_page.html new_page.html

Dont work:

RewriteRule test_page.html new_page.html [R=301]
RewriteRule ^/test_page.html new_page.html [R=301]
RewriteRule ^test_page.html new_page.html [R=301]
RewriteRule test_page.html hxxp://wwwDOTdomainDOTcom/new_page.html [R=301]

After turning on the rewrite logging, I saw what was happening:

Without the R flag, the result is:

[per-dir /var/www/html/] add per-dir prefix: test_page.html -> /var/www/html/new_page.html
[per-dir /var/www/html/] strip per-dir prefix: /var/www/html/new_page.html -> new_page.html

But, when I add the R flag:

[per-dir /var/www/html/] add per-dir prefix: test_page.html -> /var/www/html/new_page.html
[per-dir /var/www/html/] explicitly forcing redirect with hxxp://wwwDOTdomainD0Tcom/var/www/html/new_page.html

Instead of stripping the prefix, Apache is inserting the doc root path in the URL. What the heck is THAT?

Had to change it to DOTs since Im new :/


Last edited by Ahhk; 11-17-2012 at 11:52 PM.


Sponsored Links
  #2  
Old
Junior Guru Wannabe
 
Join Date: Jan 2013
Location: Virginia Beach, Va
Posts: 52
For your rules with the [R=301], did you attempt those 1 at a time, or all at once in that order you have them?

Typically you'd want to set it to [R=301,L] to indicate if that RewriteRule is triggered it knows to stop trying to process any further rules.

This rule should work, and I've verified it on my own server:

Code:
RewriteRule test.htm HTeaTeaP://domainDOTcom/test2.htm [R=301,L]
Hope that helps.

- Jacob

Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
20% Memory Used - Makes No Sense uzair21 Hosting Security and Technology 5 04-09-2011 02:14 PM
Apache rewrite rule issue please help me...... unimaxlin Web Hosting 6 02-24-2011 09:50 PM
This makes no sense to me I cannot figure out the problem lexington Programming Discussion 19 08-14-2007 03:24 AM
Apache rewrite issue rhf133 Programming Discussion 3 02-18-2006 06:45 PM
Co-location makes no sense to me. papaj123 Colocation and Data Centers 79 07-16-2004 09:24 AM

Related posts from TheWhir.com
Title Type Date Posted
Microsoft Gains Most Websites in May Netcraft Web Server Survey Web Hosting News 2014-05-09 11:38:05
Apache Market Share Falls in Netcraft October Web Server Survey Web Hosting News 2013-10-04 14:34:11
Apache Market Share Dips Slightly in June Netcraft Web Server Survey Web Hosting News 2013-06-06 13:40:21
Researchers Urge System Admins to Check for New Apache Web Server Backdoor Malware Web Hosting News 2013-05-01 11:35:53
CloudStack 4.0 Open Source Cloud Software Released as Apache Incubator Project Web Hosting News 2012-11-08 13:54:10


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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 Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?