Forum Moderators: phranque
I just want to redirect example.com and/or "all public domains" to example.com/blog but I keep getting a redirect loop.
I'm on cpanel using it's redirect tool.
If it matters I'm redirecting from the public index to a wordpress folder.
I have very little idea of what I'm doing so keep it elementary if you can please.
Is there a little bit of code that I can enter into htaccess that will stop this loop?
Thanks in advance
That's the problem, as cPanel can only "write" very-general code, and can't handle "special requirements."
You also likely want an internal rewrite, rather than an external redirect.
You'll have to code this using mod_rewrite, and the outline will be:
If not already rewritten to /blog/
Prepend /blog to the requested URL-path, and rewrite to resulting filepath.
Jim
Here's what I have:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^.*$ "http\:\/\/www\.mysite\.com\/blog" [R=301,L]
This causes a loop, what should I add/change/set on fire/hit with hammer?
RewriteEngine on
#
# If not already rewritten to /blog/
RewriteCond %{REQUEST_URI} !/blog/
# Rewrite all requests to prepend "/blog/" to the filepath
RewriteRule ^.*$ http:\\www.example.com/blog/ [R=301,L]
Jim