ruby on rails - .htaccess rewrite frustrations -
i made website in php , used parameters page/product identification.
ex.) http://mysite.com/?pid=my_products&sid=golf_clubs>in=111111111111
i've moved on using ror , i'd set redirects clean urls
http://mysite.com/my_products/golf_clubs/111111111111
i've looked @ tutorials , arrived @ this:
rewriterule ^([^/]+)/([^/]+)/([^/]+)$ ?pid=$1&sid=$2>in=$3 [nc]
i've tested url , doesn't redirect @ all. i've tried putting in .htaccess file debug , chmodded log folder 775 500 error:
rewritelog "/home/myaccount/rails_apps/myapp/log/rewrite.log" rewriteloglevel 3
as far rewrite statements in .htaccess goes, have:
rewriteengine on rewritelog "/home/myaccount/rails_apps/myapp/log/rewrite.log" rewriteloglevel 3 rewritebase / rewritecond %{request_uri} ^/downloads.* rewriterule .* - [l] rewriterule ^([^/]+)/([^/]+)/([^/]+)$ pid=$1&sid=$2>in=$3 [nc] rewriterule ^$ index.html [qsa] rewriterule ^([^.]+)$ $1.html [qsa] rewritecond %{request_filename} !-f rewriterule ^(.*)$ dispatch.fcgi [qsa,l] errordocument 500 "<h2>application error</h2>rails application failed start properly"
* on shared hosting plan bluehost (good gawd wish they'd update rails 3 soon)
if understand correctly, have rule backwards. want catch old urls , rewrite them new format, correct? in case, want this:
rewriterule ^\?pid=(\w+)\&sid=(\w+)\>in=(\w+) /$1/$2/$3 [nc,r=301,l]
adding 301 status tell user agent (including well-behaved search bots) canonical urls have permanently changed.
Comments
Post a Comment