Solved

Mod Rewrite Not Working

Posted on 2011-03-06
4
315 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 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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