Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Mod Rewrite Not Working

Posted on 2011-03-06
4
Medium Priority
?
322 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
  • 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 2000 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

Industry Leaders: 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

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

916 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