but actully i want to setup the MU Wordpress script on my own Apache server.... And i m getting this mod_rewrite (redirecting) error... please help me in it...
I forgot to ask an important question, say this was for a directory. The directory has states and counties...would I have to write this out for every single state and every single county in the state? Also, what if there are sometimes suffix on the url and sometimes not ? (sometimes whatever.html, sometimes just /whatever/) Example: www.mysite.com/directory/people/state/county/ Would I have to put that rewrite rule in for every single one or is there some kind of UBER variable type way to do this? I have been reading up on it and figured you gave me enough advice, but I don't understand how i owuld accomplish this without writing a rule for every single state and county...Please help again if you will. Thanks!! PS: I am trying to fish for myself here but having big issues doing so. (from the old line: you can give a man a fish and he eats for a day or you can teach a man to fish and he eats for life) Any help, assistance, guideence, supremem code, would be awesome Thanks. Thanks again.
Thanks Nintendo and Jack Zero for your realy helpfull reply but as i told i want to transfer old domain to new domain with all section folders, images folders and files but i will remain index.php and two section folders (with images folders in these folder) active on old domain so plz tell me an example for what code to put to redirect old domain to new domain and also what code to put to remain active of index.php and two section folders on old domain ? Plz give the whole code what to put in .htaccess as i am new with it just tell me the necessary code and some examples for my needs i will be very thankfull.
That's what ([^.]+) and $1, $2, $3... is. RewriteEngine on RewriteCond %{HTTP_HOST} ^DOMAIN\.com [NC] RewriteRule ^index\.php$ http://www.DOMAIN.com/new-file.html [R=301,L] RewriteRule ^old\-folder/$ http://www.DOMAIN.com/new-folder/ [R=301,L] Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^articles/latest\-articles$ searchresult.php?sort_id=3&sbtype=1&inname=-1,-1&exname=-1,-1&all=1 [L] RewriteRule ^articles/top\-articles\.html$ searchresult.php?sort_id=5&sbtype=1&inname=-1,-1&exname=-1,-1 [L]
Looking for help to stop some hotlinking. Some people are hotlinking directly to picture album images where the url contains picture.php, not jpg|gif|png like this. http://www.myforum.com/forums/picture.php?albumid=88&pictureid=9526 Code (markup): I use this in my htaccess and it works well: # stop hotlinking and serve alternate content RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?myforum.com [NC] RewriteRule .(jpg|jpeg|png|gif)$ [URL]http://www.myforum.com/images/hotlink.jpe[/URL] [R,NC] Code (markup): I need to include picture.php in there and I cannot seem to get it to work. Is it possible? Thank you
Nintendo thanks for reply but as i told i am new with .htaccess code so plz give some details bcoz it will be very helpfull for, i know you are busy person but if you plz give me some time i will be very thankfull. Shortly i wanna told you that i will upload whole old site to new site with same file and folder structure and names on old domain to new domain but two section folders and one main index file remain active on old domain so now plz give necessary code with some help. Thanks - hope you will never mind
Nintendo, I saw all your posting in this topic and It's amazing how you know so much. I have one problem with my website and I think that only you can help me. The problem should avoid by right code at .htaccess (I think) Check this! 1. I Have one website hosted at Globat.com, let's say (www.domain.com) Now I have decided to open a Forum on my (domain.com) hosting... 2. I bought a new domain, let's say (www.website.com) Now I have changed DNS of website.com to domain.com and It's redirecting wonderful. I have pointed the website.com directly to my forum directory (www.domain.com/vb/ and when someone enters website.com it becomes like website.com/index.php? ... So that's nice. 3. I have installed vBSEO at my vBulletin forum so I can make all my URL's to Static URL's but I got one problem than... The problem is that when I Power ON vBSEO and access my website from domain.com it works fine... but when I access my forum from website.com and clicks at any directory than Static URL becomes website.com/vb/blabla.htm And I have tried for weeks many different codes in .htaccess in order to remove that /vb/ when I access but I couldn't ... I hope that you understood my problem, if not and you want to ask me than please reply back I will give info that you need. I think that I have to mix... something with HTTP Host and HTTP Virtual Host ... I saw some codes ... My .htaccess now: # Comment the following line (add '#' at the beginning) # to disable mod_rewrite functions. # Please note: you still need to disable the hack in # the vBSEO control panel to stop url rewrites. RewriteEngine On # Some servers require the Rewritebase directive to be # enabled (remove '#' at the beginning to activate) # Please note: when enabled, you must include the path # to your root vB folder (i.e. RewriteBase /forums/) # RewriteBase /vb/ #RewriteCond %{HTTP_HOST} !^www\.domain\.com #RewriteRule (.*) http://www.domain.com/vb/$1 [L,R=301] RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L] RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap) RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/ RewriteRule ^(.+)$ vbseo.php [L,QSA] Code (markup): I really have all hopes resolving this problem at you, Thank you Very much, Besnik
Run over to vbseo.com/forums/ For complicated stuff, the Apache King is at *gags* webmasterworld.com/apache/
Just installed the ultimate seo urls for osCommerce. After asking on the forums there i didnt get much help so i really hope you can help me here. I cant even seem to get 301 redirects working in my .htaccess. The problem i have is,that i have the following style of URLs indexed: www.mp3extras.co.uk/product_info.php/products_id/96 However the script makes the urls look like this: http://www.mp3extras.co.uk/archos-60gb-leather-case-p-96.html I don't have any idea how to forward the old links to the new ones in .htaccess. I have tried numerous times and still just cant seem to get it. The script allows original oscommerce links to be rewritten as follows but does not support the old style search engine friendly urls. here is the .htaccess: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING} RewriteRule ^(.*)-p-(.*).html$ product_info.php/products_id/$2&%{QUERY_STRING} [r=301,nc] RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING} RewriteRule ^(.*)-m-([0-9]+).html$ index.php?manufacturers_id=$2&%{QUERY_STRING} RewriteRule ^(.*)-pi-([0-9]+).html$ popup_image.php?pID=$2&%{QUERY_STRING} RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING} RewriteRule ^(.*)-a-([0-9]+).html$ article_info.php?articles_id=$2&%{QUERY_STRING} RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING} RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING} RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING} RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING} rewritecond %{http_host} ^mp3extras.com [nc] rewriterule ^(.*)$ http://www.mp3extras.co.uk/$1 [r=301,nc] rewritecond %{http_host} ^mp3extras.co.uk [nc] rewriterule ^(.*)$ http://www.mp3extras.co.uk/$1 [r=301,nc] Code (markup): RewriteRule ^(.*)-p-(.*).html$ product_info.php/products_id/$2&%{QUERY_STRING} [r=301,nc] Is my failed attempt to redirect the old indexed urls. So ignore that. If there is not an easy solution to this is there something i can put in the .htaccess to get google to reindex the entire site ? I really appreciate the post you wrote up Nintendo and am really grateful for any help you give in reply to this post. many thanks, Eddy
Hi. I need help! I've read tonns of manuals already and can't find solution for my task. I have some cms. USA version at www.domain.com Want to add european versions at subdomains, like fr.domain.com, es.domain.com, de.domain.com and so on. I've created subdomain wildcard. I've added in apache config: ServerAlias *.domain.com + wrote in DNS that *.domain.com points to my IP. So, how it should looks: user loading fr.domain.com/some.php?add=1, but really it will point to domain.com/some.php?lang=fr&add=1 The subdomain goes as param (lang=fr). That's is not the problem to take this param from URI. The problem with the looping. OK, I have this code: RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^(www\.)?(en-us|en|es|pt|de|fr|jp|it)\.[^\.]+\.[^\.]+$ RewriteRule ^(.+)$ %{HTTP_HOST}$1 [E=FL:1] RewriteRule ^(en-us|en|de|it|fr|es|pt|jp)\.(.+)$ {REQUEST_URI}?lang=%1&%{QUERY_STRING} [L] Again, the problem that it's looping. I've read that if apache processing some.php to /some.php - it will cause the loop. To avoid looping I need to load some.php, WITHOUT slash! But {REQUEST_URI} always have slash as the first symbol. So I'm trying to solve this several days already, but with no result. Can anybody help? Please.
Better done server side, assuming PHP: if (preg_match('/^(?:www\.)?(en-us|en|es|pt|de|fr|jp|it)\./i', $_SERVER['HTTP_HOST'], $match)) { $language = $match[1]; } PHP:
Greetings, Attempting to have some mod_rewrite magic as listed in other examples in this (long and worthy) thread. Specifically, removing parameters passed in a URL from http://domain.com/test.php?param1=x&param2=y to http://domain.com/test.php Also useful would be a similar case for index.php's : from http://domain.com/folder/index.php?param1=x&param2=y to http://domain.com/folder/ Sorry I'm no Ralf Engelschall, and thanks for the useful posts here. Best, H.A.
Hi there, I'm trying to rewrite some parametes in case the request had came from a Iphone device. Like this: ss.mysite.com/javaaplication/p.do?url=pg if the user-agent have "Iphone" or "Ipod", rewrites to: ss.mysite.com/javaaplication/p.do?url=pg_iphone RewriteCond %{HTTP_USER_AGENT} .*?iPod.*?$ [OR] RewriteCond %{HTTP_USER_AGENT} .*?iPhone.*?$ RewriteRule url=pg$ url=pg_iphone [R] ---> does'nt work Could some one help me!?!? thanks
this has got me going in loops. i have amazon product feed by mrrat, and it is with the new xml signed request vailidate. So i've been writing a mod rewrite after a lot of research. everything is working ok, except for 1 issue. In the categories, it will get to the main product categories without a problem, and product pages seem to be ok as well. But any child categories, it just loops back on itself. It see's them and has the links, but no joy. Any takers? url: http://www.cdmaximum.com/apf4/products.cgi Here's the mod rewrite for htaccess: Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^savings\.shtml$ apf4/products.cgi [L] RewriteRule ^section/(.*)/search/(.*)/isle/(.*)/Sort/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&Keywords=$2&BrowseNode=$3&Sort=$4&ItemPage=$5 [L] RewriteRule ^section/(.*)/search/(.*)/isle/(.*)/Sort2/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&BrowseNodeName=$2&BrowseNode=$3&Sort=$4&ItemPage=$5[L] RewriteRule ^section/(.*)/isle/(.*)/search/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&BrowseNode=$2&Keywords=$3&ItemPage=$4 [L] RewriteRule ^section/(.*)/isle/(.*)/Sort/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&BrowseNode=$2&Sort=$3&ItemPage=$4 [L] RewriteRule ^section/(.*)/search/(.*)/isle/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&BrowseNodeName=$2&BrowseNode=$3&ItemPage=$4 [L] RewriteRule ^section/(.*)/search/(.*)/Sort/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&Keywords=$2&Sort=$3&ItemPage=$4 [L] RewriteRule ^section/(.*)/actor/(.*)/Sort/(.*)/Page/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=$1&Actor=$2&Sort=$3&ItemPage=$4 [L] RewriteRule ^section/(.*)/director/(.*)/Sort/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&Director=$2&Sort=$3&ItemPage=$4 [L] RewriteRule ^section/(.*)/manufacturer/(.*)/Sort/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&Manufacturer=$2&Sort=$3&ItemPage=$4 [L] RewriteRule ^section/(.*)/manufacturer/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&Manufacturer=$2&ItemPage=$3 [L] RewriteRule ^section/(.*)/isle/(.*)/sub2/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=$1&BrowseNode=$2&BrowseNodeName=$3 [L] RewriteRule ^section/(.*)/isle/(.*)/sub/(.*)$ apf4/products.cgi?SearchIndex=$1&BrowseNode=$2&BrowseNodeName=$3 [L] RewriteRule ^section/(.*)/isle/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&BrowseNode=$2&ItemPage=$3 [L] RewriteRule ^section/(.*)/search/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&Keywords=$2&ItemPage=$3 [L] RewriteRule ^section/(.*)/director/(.*)/Page/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=$1&Director=$2&ItemPage=$3 [L] RewriteRule ^section/(.*)/artist/(.*)/Page/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=$1&Artist=$2&ItemPage=$3 [L] RewriteRule ^section/(.*)/manufacturer/(.*)$ apf4/products.cgi?SearchIndex=$1&Operation=ItemSearch&Manufacturer=$2 [L] RewriteRule ^section/(.*)/isle/(.*)$ apf4/products.cgi?SearchIndex=$1&BrowseNodeName=$2 [L] RewriteRule ^section/(.*)/artist/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=$1&Artist=$2 [L] RewriteRule ^section/(.*)/actor/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=$1&Actor=$2 [L] RewriteRule ^section/(.*)/director/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=$1&Director=$2 [L] RewriteRule ^section/(.*)/director/(.*)$ apf4/products.cgi?Operation=SimilarityLookup&SearchIndex=$1&Director=$2 [L] RewriteRule ^section/Books/Author/(.*)/Sort/(.*)/Page/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=Books&Author=$1&Sort=$2&ItemPage=$3 [L] RewriteRule ^section/Books/Author/(.*)/Page/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=Books&Author=$1&ItemPage=$2 [L] RewriteRule ^section/MusicTracks/search/(.*)/Page/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=MusicTracks&Keywords=$1&ItemPage=$2 [L] RewriteRule ^section/Blended/search/(.*)/Page/(.*)$ apf4/products.cgi?SearchIndex=Blended&Operation=ItemSearch&Keywords=$1&ItemPage=$2 [L] RewriteRule ^section/Books/Author/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=Books&Author=$1 [L] RewriteRule ^section/MusicTracks/search/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=MusicTracks&Keywords=$1 [L] RewriteRule ^section/(.*)$ apf4/products.cgi?Operation=ItemSearch&SearchIndex=$1 [L] RewriteRule ^Collectible/ItemId/(.*)/Page/(.*)$ apf4/products.cgi?myOperation=Collectible&ItemId=$1&ItemPage=$2 [L] RewriteRule ^Collectible/ItemId/(.*)$ apf4/products.cgi?myOperation=Collectible&ItemId=$1 [L] RewriteRule ^Used/ItemId/(.*)/Page/(.*)$ apf4/products.cgi?myOperation=Used&ItemId=$1&ItemPage=$2 [L] RewriteRule ^Used/ItemId/(.*)$ apf4/products.cgi?myOperation=Used&ItemId=$1 [L] RewriteRule ^New/ItemId/(.*)/Page/(.*)$ apf4/products.cgi?myOperation=New&ItemId=$1&ItemPage=$2 [L] RewriteRule ^New/ItemId/(.*)$ apf4/products.cgi?myOperation=New&ItemId=$1 [L] RewriteRule ^Refurbished/ItemId/(.*)/Page/(.*)$ apf4/products.cgi?myOperation=New&ItemId=$1&ItemPage=$2 [L] RewriteRule ^Refurbished/ItemId/(.*)$ apf4/products.cgi?myOperation=New&ItemId=$1 [L] RewriteRule ^sim/ItemId/(.*)$ apf4/products.cgi?Operation=SimilarityLookup&ItemId=$1 [L] RewriteRule ^SellerListingSearch/Id/(.*)$ apf4/products.cgi?myOperation=SellerListingSearch&SellerId=$1 [L] RewriteRule ^shop/ItemId/(.*)$ apf4/products.cgi?Operation=ItemLookup&SearchIndex=&ItemId=$1 [L] RewriteRule ^sim/ItemId/(.*)$ apf4/products.cgi?Operation=SimilarityLookup&ItemId=$1 [L] RewriteRule ^Reviews/ItemId/(.*)/ReviewPage/(.*)$ apf4/products.cgi?myOperation=CustomerReviews&Operation=ItemLookup&ItemId=$1&ReviewPage=$2 [L] RewriteRule ^Reviews/ItemId/(.*)$ apf4/products.cgi?Operation=ItemLookup&SearchIndex=&myOperation=CustomerReviews&ItemId=$1 [L] RewriteCond %{SCRIPT_FILENAME} !misc/.*\.html$ RewriteRule ^(.*)/(.*)\.html$ apf4/products.cgi?Operation=ItemLookup&ItemId=$1 [L] RewriteRule ^ItemId/robots.txt$ ItemId/robots.txt [L] RewriteRule ^ItemId/(.*)/image$ apf4/products.cgi?Operation=ItemLookup&ItemId=$1&myOperation=Image [L] RewriteRule ^ItemId/(.*)$ apf4/products.cgi?Operation=ItemLookup&ItemId=$1 [L]
I have a problem with redirecting a subdomain to the root folder. I want: sub.domain.se/1 Code (markup): to look like: domain.se/1 Code (markup): or if that's not possible: domain.se/sub/1 Code (markup): I've used the following code as in your first post in this thread: Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^[www\.]*sub.domain.se [NC] RewriteCond %{REQUEST_URL} !^/sub/.* RewriteRule ^(.*) /sub/$1 [L] Code (markup): But I don't understand how to make it work. I would really appreciate your help!