Forum Moderators: phranque
I had http://example.com/blog/
And now I have simply http://example.com/
I had http://blog.example.com/
And now I have simply http://example.com/
I also had http://blog.olddomain.org/
which needs to be http://example.com/
All the same example.com above.
I need both to redirect correctly while preserving the path / query string (which have never changed)
What I've got so far is :
RewriteBase /
RewriteRule ^blog/(.*)$ /$1 [R=301,NC,L]
Which works perfect and fast.
I've Google'd and tried many solutions (which to my limited knowledge of mod_rewrite, should work)
I even worked it myself first (and then went to Google)
Many of the solutions were from here.
If it matters... I used Godaddy Shared Unlimited Hosting
[edited by: jdMorgan at 1:32 am (utc) on Sep. 5, 2009]
[edit reason] example.com [/edit]
RewriteRule ^blog/(.*)$ http://example.com/$1 [NC,R=301,L]
There are plenty of examples of domain canonicalization rules posted here -- at least one today, in fact.
Jim
But the other examples are the ones I'm struggling with...I've tried at least 5 unique examples, (and many variations on those) and all return Forbidden
The result I get is : "You don't have permission to access /author/category/title on this server."
(where I've replaced the names on the path)
I could just create a subdomain pointed to a folder and then use a PHP/JavaScript redirect to correct...but that tends to be slower with my experience.
The last example problem's solution would go on the old server (which I still have control of, so I could do it) (the old server is being used to host a different domain I own)
Well, if you'd post one of these, we would have a basis for discussion. (If this statement isn't clear, a review of our Forum Charter would be recommended.)
You'll need a RewriteCond examining %{HTTP_HOST} on the old server if you've got two domains (one that you want to redirect, and one that you don't) both pointed to the same filespace on that server.
Thanks,
Jim