Hi there, i'm sure that this has been asked before, but i can't find it thru the search feature, so, i'll just spit it out. What's the difference between next 2 uri's (seo wise), why would i go with one and not the other? 1. myurl.com/dir/page.html 2. myurl.com/dir/page Did anybody test this on his/her website, and can tell if one could do better in the serps than the other? Thanks.
FANTASTIC! the rewrite works perfectly, though I didn't quite understand correctly how to do the 301 redirect?
Redirecting from the dynamic URLs would make the fake URLs go bazerk. Before geting indexed is when mod_rewrite should be done!! print "Location:http://www.domain.com/whatever/$FORM{'contact'}/\n\n"; in perl is the only way I know of.
ok thanks. do you know how i could do a catchall 301, whereby any 404 requests are 301'd to say the homepage?
Hi everyone, I have a mod_rewrite question and was wondering if you could help me out. I need to change the url from this: http://domain.com/rgp/index.php?group=1&offset=20&thread=15483&id=65372 to this: http://domain.com/rgp/15483/65372.html Also since the mod_rewrite changes the URL only, how do I make the database to show URL's in this format...preg replace? Is there an easier way? Thanks, nQQb
Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^rpg/([^.]+)/([^.]+)\.html$ rpg/index.php?group=1&offset=20&thread=$1&id=$2 [L]
Hi nintendo, I tried this and also something else...my php script is a bit complicated and changed urls frequently, I have given up on it...thanks for your help though ...much appreciated
I can't seem to get this to work for links that are generated with spaces (from old oscommerce): here is the link: /category.cfm?cat=18&catname=All%20Server%20Rack%20Enclosures I simply want to use the link /18/All/Server/Rack/Enclosures/ but when I try pointing to /18/All/Server/Rack/Enclosures/ I get a 404
hello. currently i only have article id in the url to query the article (since the article id is unique key so that's enough), but in the result url (after mod_rewrite) i want to have the article title instead of article id, much like digg.com url. for example: real URL: www.somepage.com/article.php?id_art=5 (id_art is the article_id) to become: www.somepage.com/google_vs_microsoft/ (google_vs_microsoft is article title) is it possible not adding the article title to real URL when i'm querying the article id? if it's not possible then should i change the way i'm querying article? (currently only using article_id because that's the unique key in the database)
In your table of articles or content items, make the title field an INDEX, and change the queries from "id = " . (int) $_GET['id_art'] to "title = '" . mysql_real_escape_string($_GET['title']) The above assumes a very simple PHP/MySQL based application. Your .htaccess would be: <ifModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/?$ article.php?title=$1 [L] </ifModule> Of course, you would also have to change links to point to the new URLs. And remember to add code in article.php to send a 404 if the article is not found as this method redirects any URL request to article.php (except for actual files).
What is wrong with the following rewrite mode rule. Id user access index.html then it should be redirected to articles.php. .htaccess assume all the files under www.site.com/articles/ when we enter www.site.com/articles/index.html should be redirected to www.site.com/articles/articles.php Options +FollowSymLinks RewriteEngine on RewriteRule ^index.html$ articles.php
And if it still doesn't work, add a RewriteBase line. RewriteEngine on RewriteBase /articles/ or RewriteBase / depending on where the .htaccess file it.
No need for full URLs, they just end up with another DNS lookup. I also second Nintendo's suggestion to use RewriteBase, e.g.: RewriteBase /articles/ RewriteRule ^index.html$ articles.php [R=301,L]
Hello gr8 ppl overhere. I have little problem, I had site with these kind of URLs: http://www.something.com/?d=B9F5E8311 Code (markup): Now I am moving to another domain, which will have these kind of URLs: http://www.somethingnew.com/index.php?p=download&hash=k9PskIfNgwEj Code (markup): So, how can I redirect users from first URL to second one? is it possible?
You would have to have one line for every single URL since they have a different ID. Aka, going from B9F5E8311 to k9PskIfNgwEj instead of staying the same.
...then this will work: something.com/.htaccess Options +FollowSymLinks RewriteEngine On RewriteCond %{QUERY_STRING} ^d=(.+) RewriteRule . http://www.somethingnew.com/index.php?p=download&hash=%1 [L,R=301] Code (markup):