You can't have the URLs not have the language code in the URL. There would be no way for apache to know what script the URL is from. Something has to be unique in each language URL.
hi nintedo, yes i agree with you. i have no problem with example.com/lang/de/page.html for german example.com/lang/fr/page.html for french its just on exiting via my jump script. all jump links on example.com/lang/fr/page.html is redirected to the destination URL IN FRENCH is there a catch all codes for say all example.com/lang/de/jump-xxx.php example.com/lang/ru/jump-xxx.php example.com/lang/fr/jump-xxx.php example.com/lang/es/jump-xxx.php example.com/lang/jp/jump-xxx.php ... etc would be redirected to example.com/jump-xxx.php ?? thank you very much.
RewriteRule ^jump-(.*).asp$ jump.php?id=$1 [L] RewriteRule ^jump-(.*).asp$ language/de/jump-$1 [L] RewriteRule ^jump-(.*).asp$ language/es/jump-$1 [L] RewriteRule ^jump-(.*).asp$ language/fr/jump-$1 [L] will never work because apache has no idea which script to get, since all the scripts are fighting over each other at the exit URL. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^([^.]+)/jump\-([^.]+)\.asp$ language/$1/jump.php?id=$2 [L] domain.com/language/de/jump.php?id=XXX being the same as domain.com/de/jump-XXX.asp And if you want it search engine friendly, you'll do .html instead of .asp or .php.
hi nintendo, it is still acting like domain.com/language/de/jump-xxx.asp i think i should also include that on /language folder there is also an .htaccess for the language translator the .htaccess on /language folder. ------------------ Options +FollowSymLinks RewriteEngine On RewriteCond %{QUERY_STRING} !^$ RewriteRule ^(.*)\.asp$ /language/$1.asp? [R=301] RewriteRule ^([A-Za-z0-9_-]+)(/.*)$ index.php?language=$1&page=$2 [L] ----------------------- it may be messing with the rule on the root .htaccess.
Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^([^.]+)/jump\-([^.]+)\.asp$ language/$1/jump.php?id=$2 [L] RewriteCond %{QUERY_STRING} !^$ RewriteRule ^language/(.*)\.asp$ language/$1.asp? [R=301] RewriteRule ^language/([A-Za-z0-9_-]+)(/.*)$ language/index.php?language=$1&page=$2 [L] is a guess. What was RewriteRule ^(.*)\.asp$ /language/$1.asp? [R=301] for. it looks like its changing the URL to the same thing, or you have language/language/ in the URL.
Google is currently indexing the majority of my static HTML content pages as opposed to the include on the main site. For example, Google indexes www.site.com/pages/info/site/site.html but not www.domaincom/site/ or whatever. I have tried: RewriteRule ^(.*)\.htm$ /site/$1/ [R=301,L] But if I request the page www.site.com/pages/links.htm, it will rewrite to http://www.site.com/site/pages/links/ Is there any way I can get it to rewrite only the filename of the HTML file instead of the full directory?
Hi. I have played around and trying to do this. * redirect all URL's of http://domain.com/whatever.php to http://www.domain.com * Redirect all urls of http://www.domain.com/whatever.php to http://www.domain.com I.E = Rewrite everything to the indexpage with a 301-redirect. This is the code i am using, but i cant get it to work <IfModule mod_rewrite.c> RewriteEngine on Options +FollowSymLinks RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] RewriteRule ^(.*) http://www.domain.com/ [L,R=301] </IfModule> I get the non-www version to redirect good, but unfortunalty i dont get the www.domain.com/whatever.php to redirect to www.domain.com Anyone who can be a friendly soul ?
Nice guide, but I still can't figure out how to redirect this URL http://www.sefanatics.com/news/index.php?itemid=7 to http://www.sefanatics.com/reviews/sony_ericsson_w600i_review/ Having problems with this part ?itemid=7 Could some one help me?
The 7 has to be in the URL, and do you know php enough to add it to the URL and replace spaces with _?
Hey Nintendo, first of all a great thread I have this new shopping site which is filled with aspx pages , and i am completely new to mod rewrite, need to ask a few questions 1) Is it possible for mod_rewrite of aspx pages using .htaccess or should something be done with IIS side 2) If yes for the above query,there are around 100's of pages whose url's need to rewritten ( for different keywords) should it all be put in a single .htaccess file if these get cleared ..there will be more queries.Thanx
Do a little test.... domain.com/.htaccess Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^wacko\.html$ index.aspx [L] If domain.com/wacko.html shows the index, then it works. index.aspx is what ever the index file name is. Something tells me it won't work. I once tried mod_rewrite on a Windows server, and nothing happened. Spend some time hanging around the php board for search and replace stuff, until you know how to for example have sefanatics.com/reviews/7/sony_ericsson_w600i_review/ where it spits out the links in the script.
Very nice nintendo, Thanks for sharing such a great tutorial i m just looking for .htaccess tutorial. thanx again..
My questions involves the seo implications of using the code below to direct all requests for non existent files and directories to the front page of a site using the code below. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) index.php This prevents any 404's from being returned from the server and shows a 200. When i was setting up my Google webmaster account I noticed this. What it be a better solution to provide a friendly 404 error message instead. I have already 301 all my old pages to there new homes so the only time a 404 should be returned is when a user types in a link that never existed.
When googlebot and other search engines request a page that doesn't exist, they realize the page doesn't exist when a 404 Status Code is returned. If a 200 Status Code is returned such as in your setup, then the search engines don't realize your page is missing, and this means your ranking will be hurt big time. More info: Apache ErrorDocuments and HTTP Status Codes
Hey thanks a lot Nintendo this has been very helpful! I cant decide if I want to use hypens (-) or forward slashes (/) to separate my url are there any useful advantages of one over another?