Solved

Mod Rewrite Not Working

Posted on 2011-03-06
4
316 Views
Last Modified: 2012-05-11
Hello All--
What I am trying to do is redirect URLs formatted like this:
xyz.com/blog/?p=918
to this
xyz.com/?p=918

So I want to preserve the query string at the end, but ditch the subdirectories with 301s.  

Attached is what a previous expert gave me.  Obviously, I changed the domain name to my own.  I uploaded the file to public_html and no go... The redirect isn't happening.  Any ideas?


RewriteEngine on

RewriteRule ^http://domain.org/blog/(.*)$  http://domain.org/$1 [R=301,L]

Open in new window

0
Comment
Question by:nplescher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:sjklein42
ID: 35045366
Try it without the domain:

RewriteEngine on

RewriteRule ^blog/(.*)$  $1 [R=301,L]

Open in new window

0
 

Author Comment

by:nplescher
ID: 35045751
No.

Using this rewrite redirects the user to:

http://domain.org/home/username/public_html/?p=980
0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 500 total points
ID: 35045772
Maybe you're missing the RewriteBase line:

Options +FollowSymLinks
 
RewriteEngine On
RewriteBase /

RewriteRule ^blog/(.*)$  $1 [R=301,L] 

Open in new window

0
 

Author Closing Comment

by:nplescher
ID: 35047036
Perfect!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question