Hi,
I'm trying to do a .htaccess Redirect:
Redirect /foo http://www.site.com/bar.html
But when I try to access http://www.site.com/foo it brings up the URL http://www.site.com/bar.html?q=foo
which shows my initial page /foo and not my redirected page.
my .htaccess looks like:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
What is it that I'm missing?
Thanks!
.htaccess Redirect Issue
Started by
siiimon
, May 07 2012 03:48 AM
1 reply to this topic
#1
Posted 07 May 2012 - 03:48 AM
#2
Posted 20 May 2012 - 07:52 PM
Hi siiimon,
Sorry for the late response.
You are missing the rewrite option in Etomite in combination with the RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] line.
This cause for all the /text-entries to be rewritten in to www.site.com/index.php?q=text-entries
It can be most depressing when you try to add a rewrite to the existing rewrite, and getting not what you want.
Maybe this is an option you could try:
to force a rewrite to /index as root you can add :
If you use site/ it will rewrite it to site/index
if you use site/test it will do nothing.
So to explain the above example if you use /foo it will rewrite, but /FOO will not.
Please let me know if this works for you, or not
I hope this help you
Sorry for the late response.
You are missing the rewrite option in Etomite in combination with the RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] line.
This cause for all the /text-entries to be rewritten in to www.site.com/index.php?q=text-entries
It can be most depressing when you try to add a rewrite to the existing rewrite, and getting not what you want.
Maybe this is an option you could try:
RedirectMatch 301 ^/foo$ /bar.htmlMind you, I have not tried this, but this is the option to trigger a rewrite only if the condition is true.
to force a rewrite to /index as root you can add :
RedirectMatch 301 ^/$ /index
If you use site/ it will rewrite it to site/index
if you use site/test it will do nothing.
So to explain the above example if you use /foo it will rewrite, but /FOO will not.
Please let me know if this works for you, or not
I hope this help you
Edited by Ed Headset, 20 May 2012 - 07:56 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











