HI, My link url is : http://domain.com/dlinks/links/linkit.php?id=6 I want to rewrite as : http://domain.com/dlinks/links/6.html how can i do that? please help me.
Try this in a domain.com/dlinks/links/.htaccess file: Options +FollowSymLinks RewriteEngine On RewriteBase /dlinks/links/ RewriteRule ^([0-9]+)\.html$ linkit.php?id=$1 [L] Code (markup):
Hi Nintendo, First thanks for the lovely guide in the beginning - I tried but somehow messed up. I have both the pages mysite.com/ and mysite.com/index.php in diff PR. I wanted to redirect /index.php to .com/ First I used the code : This sent the site on an infinite loop. My hosting ppl said it needs higher coding... like u said mod_rewrite is voodoo ... so i gave up. As of now I have this code below, which is working well - which redirects the http://mysite.com to http://www.mysite.com I need help in redirecting all /index.php to .com/ - The script of the site is too big to omit all reference to /index.php ... Thanks, JS
Put the RewriteRule ^index.php$ http://www.domain.com/ [R=301,L] before the RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] stuff. If that doesn't work, just link to the URL without index.php.
Hi Nintendo, Done that, but again its not working. Also removing the ref of /index.php is diff as its a large script and the instructions goes thru smarty. Any other way you might think off... as this is a bugging issue for many... and maybe it is bcoz both the url share the same page... I have a silly idea... we have error pages like 400.shtml, 401,402 etc... which redirects ppl to the home page... What happens if we use mod re-write in redirecting /index.pages to some intermediate page ... will that work..if yes then what will be the code like. Thanks JS. PS. Dont laugh at my idea if it is funny
Hi Nintendo, Another help required. I have two long urls coming like: mysite.com/view_video.php?viewkey=f9c4f6877e1894a1faa0&page=1&viewtype=&category= mysite.com/view_video.php?viewkey=51c63a55cdb8cb047fad&page=1&viewtype=&category=mr which I would like to reduce tosomething like: mysite.com/view_video.php?viewkey=f9c4f6877e1894a1faa0 & mysite.com/view_video.php?viewkey=51c63a55cdb8cb047fad Please help me with the rewrite code. Thanks, JS.
Hi Nintendo, I have read all your post and scrapped the net and found a solution to redirecting index page to homepage. Meaning any homepage/index.extn (php or html) to the homepage. Normally if we use "RewriteCond %{HTTP_HOST}" or "{REQUEST_URI} then a client request for / is internally re-written as /index.html by mod_dir which always executes before anything else. And only after which mod_rewrite is invoked which redirects it to / and the process repeats ( as the call is to the same page) until the redirection limit is hit on the server or your host suspends your account. The code: This code verifies the original request of the client which is not updated by mod_dir like it does for http_host and request_uri. The other variant is: In some palce i saw the advice of using " [A-Z]{3,9} " though i dont understand what good it is. The second code is supposed to work for all directories (?) (Pls replace html with php wherever needed) I am currently using th code below: The only problem is though it works for /index.php it does not redirects domain.com/index.php? and domain.com/? which comes occasionaly. Both of the codes will work and there will be no infinite loop. I would leave it to "Nintendo" to tell us if we can use this and if there is any downside to it in terms of SEO or indexing. I would also request you to let us know if we need any line of code in the robots.txt file to disallow SE's from indexing the index page. Also , whether we need to remove /index.php reference from the sitemap.xml file if any. Regards, JS.
If it works, you can use it! I'm a total n00bie when it comes to RewriteCond stuff. Is there anything that you don't have working right now?
Why not just use Options All -Indexes DirectoryIndex index.php index.html Code (markup): I recommend using Googles Webmaster Tools to see what you need to do for SEO, use the robots.txt analysis tool You can read about SEO with robots.txt, and Wordpress robots.txt optimized for SEO
Dear Nintendo, I appreciate your honesty and help. I just got the RewriteCond stuff from somewhere on the net - i am a gr8r noobie than you. But it's working in re-directing the index page without any loop! I need help with the re-write rule. The current code is: What changes are required so that index.php , index.php?, and /? all gets redirected to domain.com I tried the above also, but it does not work. Regards, Jack
Can you edit the script so the links don't have index.php , index.php?, and /? Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^index\.php$ http://www.domain.com/ [R=301,L] RewriteRule ^index\.php\?$ http://www.domain.com/ [R=301,L] RewriteRule ^/\?$ http://www.domain.com/ [R=301,L] But I'm guessing it might not work since it has ?. I think ? needs a RewriteCond.
Hi Nintendo! I have been able to solve(?) one of the problem (index.php/?) by playing around with the RewriteCond ... its real voodoo. You were correct in saying that "?" requires special treatment of RewriteCond. Here it is : RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php?\?\ HTTP/ RewriteRule ^(.*)index\.php?$ http://www.domain.php/$1& [R=301,L] There is a funny thing happening - its redirecting as if in two steps: Please check the url and tell me if it is Ok or if it needs correction: http://www.hotclips.mobi/index.php? The other problem redirecting mydomain.com/? to mydomain.com is still there... let me know if you can help me from the above code. I require one more help also: To change the url: /view_video.php?viewkey=f1586614cf2c1ad240b6&page=1&viewtype=&category= to something like: /view_video.php?viewkey=f1586614cf2c1ad240b6 and also advice me where to place it in the htaccess file. The current code is: Options +FollowSymLinks +Indexes Thanks, Jack.
For mydomain.com/? my only guess is RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\?\ HTTP/ RewriteRule ^?$ http://www.domain.php/ [R=301,L] RewriteRule ^([^.]+)/([^.]+)\.html$ viewkey=$1&page=$2 [L] /view_video.php?viewkey=f1586614cf2c1ad240b6&page=1&viewtype=&category= to f1586614cf2c1ad240b6/1.html If you have more than one page, you'll have to have the page part in the URL. view_video.php?viewkey=f1586614cf2c1ad240b6 isn't search engine friendly at all.
Hi, The code for /? is giving a 500 error For the pages below, pls suggest me a proper Search engine friendly rewrite. Also, not one but there are approx 12000 + pages in this category.There are three diff url's which the script generates but all pointing to the same file. I have listed them below: /view_video.php?viewkey=31919438fcfc6bd5f199 /view_video.php?viewkey=31919438fcfc6bd5f199&page=1&viewtype=&category= /view_video.php?viewkey=31919438fcfc6bd5f199&page=1&viewtype=&category=mr The viewkey=number_alphabet part is variable ( over 2500+) and also the category=alphabet part Also tell me how to put the code with reference to my current .htaccess codes. Thanks and much more, JS.
Options +FollowSymLinks +Indexes RewriteEngine On RewriteBase / RewriteRule ^view/([^.]+)/([^.]+)/([^.]+)\.html$ view_video.php?viewkey=$1&page=$2&viewtype=&category=$3 [L] RewriteRule ^view/([^.]+)/([^.]+)\.html$ view_video.php?viewkey=$1&page=$2&viewtype=&category= [L] RewriteRule ^view/([^.]+)\.html$ view_video.php?viewkey=$1 [L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php?\ HTTP/ RewriteRule ^(.*)index\.php?$ http://www.hotclips.mobi/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php?\?\ HTTP/ RewriteRule ^(.*)index\.php?$ http://www.hotclips.mobi/$1& [R=301,L] RewriteCond %{HTTP_HOST} ^hotclips.mobi RewriteRule (.*) http://www.hotclips.mobi/$1 [R=301]
Nintendo sensei, how can i do the rewrite from http://www.heavydirectory.com/detail.php/link-884.html to http://www.heavydirectory.com/detail/mycustomerwebsitename.html I guess there won't be any similar name allow on the directory. Want it to look more seo friendly than just a number for my valued customer. Thanks in advance.
For some unknown reason these codes are not working for any of the three url's. Any idea.. or changes required... Thanks, Jack.
Nintendo how do I do this ? Please help, I readed 20 pages of this forum and didn`t find the answer. Can`t read anymore, my eyes are dead I currently redirect http://subdomain.domain.com to http://12.12.12.12/dir/dir/dir and it works, it actually redirects to http://12.12.12.12 but I want to keep:the http://subdomain.domain.com/dir/dir/dic in the address bar instead of going straight to http://12.12.12.12/dir/dir/dir The current .htaccess I got ( which makes the redirections of the subdomain to 12.12.12.12 RewriteEngine on RewriteCond %{HTTP_HOST} ^sub.domain.com$ [OR] RewriteCond %{HTTP_HOST} ^www.domain.com$ RewriteRule ^(.*)$ http://12.12.12.12 [R=301,L] Any help would be appreciated.. Thank you !