ok...i got the redirection working now... ...from /index.html to www.domain.com dont ask me what this code means...i got this code from Webmaster world forum thanx nintendo for all the support...
Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^viewoffer\-([^.]+)\.html$ view_offer.php?id=$1 [L] RewriteRule ^([^.]+)\.html$ $1.php [L] RewriteCond %{HTTP_HOST} !^www\..* [NC] RewriteRule ^([^.]+)$ http://www.%{HTTP_HOST}/$1 [R=301] RedirectMatch permanent ^/gen_confirm.php$ http://www.my site.com php to html will only work if this is with every file, even the index file.
Thanks Nintendo but tried your suggestion with no luck. The permanent redirect (that was already there) [no www. to www] works. But all the others show the same .php extensions unchanged. Would like to get rid of these and change em to .html or / , but like i said your suggestion is not working. Any idea why?
Sorry, i was wrong even the permanent redirect [no www to .www] is not working now. only if i change the ([^.]+) to (.*) does the permanent redirect work. This doesn't work on the others though.
Thanks! was a bit mixed up. Got confused with how the redirect works. The rewritten url's work. But how would i make it to make all the new urls if typed: selloffers.php will redirect to selloffers.htm and view_offer?id=71 will redirect to view_offer-71.htm? Again thanks for the help
I am trying to make an ecommerce site SEO-friendly. The site uses an undocumented perl sript provided by the hosting company. Product pages look like this: domain.com/cgibin/shop?info=item&sid=12345678 Using mod_rewrite I can make them look static like domain.com/info/item/12345678 But is there any way to use .htaccess to drop the sessionid for robots or serve them a static id? I thought about something like: IF HTTP_USER_AGENT contains google, msnbot THEN rewrite whatever sessionid to domain.com/info/item/robot123 But how to do this? I am new to .htaccess and that is a bit too advanced to me ... And I know, that this is NOT a great solution, but I do not see any other Some better suggestions? (I do not have access to the perl source, only to html-templates). Any help greatly appreciated.
The script would be where to do that. The script makes the fake URLs, and mod_rewrite only makes the fake URLs work. It might be a good idea to get a web host where you have access to the script. I'm not sure if you can, but I'm guessing you might be able to do a If HTTP_USER_AGENT...do a 301 redirect to new URL some how.
All my pages are mod rewrited to .html extension. It works great. Thanks Ninno. But SE bots still keep hitting my old .php files even though I have no links to them anywhere in my site. Hence I try to redirect the bots to new static URL in the following way. Kindly correct this if im wrong. Method#1 #Redirecting direct file request to mod-rewritten urls RewriteCond %{THE_REQUEST} ^(.*)\.php\ HTTP/ RewriteRule ^(.*)\.php$ http://www.example.com/$1.html [R=301,L] #Rewriting for static URLs RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)\.html$ $1.php [T=application/x-httpd-php,L] #Method 2 RewriteCond %{HTTP_USER_AGENT} ^Google.* [OR] RewriteCond %{HTTP_USER_AGENT} ^Yahoo.* [OR] RewriteCond %{HTTP_USER_AGENT} ^msn.* RewriteCond %{HTTP_REFERER} ^$ RewriteCond %{REQUEST_FILENAME} ^(.*)\.php RewriteRule ^(.*)\.php$ http://www.example.com/$1.html [R=permanent,L] Method #1(derived from maildeepak's post) works fine for me without any problem.
anything wrong with this code. This code is working fine on my old server but not working new server Kindly advice. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^downloads/songs/(.*)\.html$ downloads/songs/downloads.php?path=$1 [L] RewriteRule Pakistani-Music(.*)\.html$ list.all.downloads.php?page=$1 [L] RewriteRule ^PakistaniMusic/(.*)\.html$ downloads/songs/download.php?filename=$1 [L] Code (markup):
Odds are the server is on crack. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^downloads/songs/([^.]+)\.html$ downloads/songs/downloads.php?path=$1 [L] RewriteRule ^Pakistani\-Music([^.]+)\.html$ list.all.downloads.php?page=$1 [L] RewriteRule ^PakistaniMusic/([^.]+)\.html$ downloads/songs/download.php?filename=$1 [L]
Still not working. I check via phpinfo and it shows me mod_rewrite is working. I talked to tech team and they are saying mod_rewrite is enable. I am Crack i am facing this problem for the last 3 days .
Do this test... domain.com/.htaccess Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^wacko\.html$ index.html [L] Change index.html to what ever the index file is, then go to domain.com/wacko.html if that doesn't show the index page, mod_rewrite doesn't work!!!
No. the problem is with Server directroy structure the temporary path they given me for files to restore isnt working with mod_rewrite. I trasnfered a temporary domain to the server to check mod_rewrite working or not using the same code and it works and i hope it works for my primary domain aswell now going to change the DNS of domain
Is it possible to exclude specific folders (like admin area) from mod rewriting? Im using like to prevent admin urls rewritten. Is there any right(short) method for the same?
if you wanted to buy godaddy hosting i sad that godaddy don't have mod rwrite mod... i chech alot of mail but they don't help me... how can i add url mod manuel to my account?