• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

Mod Rewrite Not Working

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
nplescher
Asked:
nplescher
  • 2
  • 2
1 Solution
 
sjklein42Commented:
Try it without the domain:

RewriteEngine on

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

Open in new window

0
 
nplescherAuthor Commented:
No.

Using this rewrite redirects the user to:

http://domain.org/home/username/public_html/?p=980
0
 
sjklein42Commented:
Maybe you're missing the RewriteBase line:

Options +FollowSymLinks
 
RewriteEngine On
RewriteBase /

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

Open in new window

0
 
nplescherAuthor Commented:
Perfect!!
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now