Zach Posted October 18, 2003 Posted October 18, 2003 I have read that search engines have an easier time indexing php files w/ query strings when you use an Apache mod_rewrite function to reformat the url...something like: www.website.com/yourphp.php?q=blah would be instead: www.website.com/yourphp/blah/ Is this something we are able to do on our shared servers? If so how would we do that. If not, does anybody know of an alternate fix? thanks Zach Quote
shakes Posted October 19, 2003 Posted October 19, 2003 i don't know what tch's policy is on this ... but assuming it's enabled you can do it in your .htaccess file. you've gotta be real careful with this tho ... one wrong move or syntax error and you could thread out the server (i've done it before on another host, as a result i don't mess with it anymoe). also realize this could significantly slow your resonse times. Quote
Frylock Posted October 19, 2003 Posted October 19, 2003 I really don't know much about mod rewrite either, but I did try it out here. I was basically trying what you said: RewriteRule /article/([0-9]+)/$ /article.php?story=$1 [T=application/x-httpd-php] And it did work, if that helps any. I don't really use it though. I still just use the "article.php?story=xxx" URLs for now. I don't know if the difference between these two simple links makes that much of a difference to search engines anyways. But what do I know. Quote
Wilexa Posted October 19, 2003 Posted October 19, 2003 Zach... I have tried this on my site. I use the ForceType directive in my .htaccess file. (Do a google search on "clean nice urls forcetype" and you will find many tutorials.) Both the "slides" and "slideshow.php" files are really PHP inside, but I like this URL: **http://www.wilexa.com/lb/slides/up/2003-10-06/2 much better than **http://www.wilexa.com/lb/slideshow.php?currentPic=1&mo=&subj=&vw=&rec=&up=2003-10-06&all= I don't know that search engines (or users) care that much since people are unlikely to actually type in either one. But it makes me happy. ...dave P.S. I could clean up the second one to be **http://www.wilexa.com/lb/slideshow.php?currentPic=1&up=2003-10-06, but it still looks ugly! Quote
surefire Posted October 19, 2003 Posted October 19, 2003 I also have used Force Type to pass variables to my php code. I used Mod Rewrite on another host before I moved to TCH... I can tell you that Force Type is MUCH easier. In my experience, Google will follow and index dynamic urls but they seem to give higher credence to urls that appear static. Quote
Wilexa Posted October 20, 2003 Posted October 20, 2003 I just found my favorite (i.e. the one I used) tutorial on ForceType: h**p://www.devarticles.com/art/1/143/1 HTH, dave Quote
Zach Posted October 20, 2003 Author Posted October 20, 2003 I figured it out everybody, thanks. In case anyone is interested, here is the simplest way I came up with: I had the url http://www.zachrosing.com/portfolio/index.php (and project.php) and they would each have only one query string. So I renamed index.php to index and project.php to project. I changed all my links and images to absolute instead of relative (added /portfolio) I added this to my .htaccess file: <FilesMatch "^index$"> ForceType application/x-httpd-php </FilesMatch> <FilesMatch "^project$"> ForceType application/x-httpd-php </FilesMatch> I added this to the first line of my php files: $expl = explode("/",$HTTP_SERVER_VARS["REQUEST_URI"]); And now $expl[3] is the variable of my query string. For backwards compatiability for people linking to my old addresses, I made index.php and project.php files which consisted of this: <? include 'index'; # (filename of actual php file) ?> And I left in stuff in the php files to check for either $expl[3] or for $_GET. And everything works great... http://www.zachrosing.com/portfolio/project/kickoff02 does exactly the same thing as http://www.zachrosing.com/portfolio/projec...ename=kickoff02. Zach Quote
a__kc Posted October 28, 2003 Posted October 28, 2003 In my experience, Google will follow and index dynamic urls but they seem to give higher credence to urls that appear static. Google seems to send out kinder and gentler robots. In my experience, though, I've had to issue directives to other robots to keep them out of, say, a PHP calendar with a dynamic link for each day and many, many years. One robot downloaded 100 megs just traversing the calendar Mad!!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.