Forum Moderators: phranque
[mydomain.net...]
to
[mydomain.net...]
on the .htaccess file located on my root I have :
Options +FollowSymLinks
RewriteCond %{query_string} ^cPath=24_31
RewriteRule ^shop/index\.php$ http://mydomain.net/shop/mode/bijoux.html? [R=301,L]
but it just doesn't work.
Options +FollowSymLinks
RewriteCond %{query_string} ^cPath=24_31
RewriteRule ^shop/index\.php$ [mydomain.net...] [R=301,L]
Hi loic & Welcome to WebmasterWorld!
There are two things I'm seeing:
1.) If this if your entire file, you are missing the ever important RewriteEngine on
2.) QUERY_STRING should be capitalized.
Other than that it looks good, so the version I would tell you to try is:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^cPath=24_31
RewriteRule ^shop/index\.php$ http://example.com/shop/mode/bijoux.html? [R=301,L]
You could 'end anchor' your QUERY_STRING too:
^cPath=24_31$ but that's minor and should not effect the rule working.
Let us know how that goes and if it doesn't work, please provide some specific details re 'doesn't work' so we can trouble-shoot it a bit deeper.
I've investigated and turns out there is another .htaccess WITHIN the /shop/ directory and I guess it might confict.
(this is a magento install)
############################################
## never rewrite for existing files, directories and links
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l############################################
## rewrite everything else to index.php
RewriteRule .* index.php [L]
I've investigated and turns out there is another .htaccess WITHIN the /shop/ directory and I guess it might confict.
The merging will override your /path/document/root/.htaccess, yes. Either you move your rule to the subdir (by adjusting the rule-pattern accordingly ( ^index\.php$ ) or your other rule to the document root (with path adjustments, of course).
If you don't use symbolic links within your documentroot and its subdirs at all, you could drop the third condition since checking for such would be useless in those cases.
for the record, my testings were confused like jdMorgan said but NOT because of cache. It's because I was on a MAC !
using dreamweaver, updating .htaccess and uploading it was crashing my site with 500 errors.
Only when I SSH'ed I culd see a ^M causing the file to be only 1 line ....
Now I know that the ^M is actually a MAC carriage return.
Anyone knew that ?
Thanks again