When I use this, the pages are not storing sessions :(
The site has a member login and it workls but after that the session gets timed out
| SitePoint Sponsor |
When I use this, the pages are not storing sessions :(
The site has a member login and it workls but after that the session gets timed out
As of PHP 4.3.2, PATH_TRANSLATED is no longer set implicitly under the Apache 2 SAPI in contrast to the situation in Apache 1, where it's set to the same value as the SCRIPT_FILENAME server variable when it's not populated by Apache. This change was made to comply with the CGI specification that PATH_TRANSLATED should only exist if PATH_INFO is defined.
Apache 2 users may use AcceptPathInfo = On inside httpd.conf to define PATH_INFO.
It's a predefined variable, $_SERVER.
What a search engine sees is the page going out of the web server. don't see how we can achieve that without rewrite the pages.
i have noticed reallysimpleserver at www.reallysimplesoft.com which does rewrite on the fly. never tried.
cant you just use $_SERVER['REQUEST_URI'] instead of $PATH_INFO to get around this?
On servers with PHPSUEXEC, ForceType doesn't work. Instead use SetHandler, with everything else exactly the same, and it will work fine.
The zend framework uses query string like this:
www.somesite.com/search/name/value/name/value
e.g.
www.somesite.com/search/lang/en/term/monkeys
and then getParam('term') to retreieve them.
This eliminates some of the problems described in this blog but does make URLs longer.
Be aware if you are using any additional forward slashes in your URL that all your <link>, <img>, <script> and <a> tags with src or href attributes will be relative to the whole URL now. So you will often want to prefix them with / to make them relative to your domain.
For example the page retreived with www.somesite.com/search/lang/en/str/monkeys may have <img src="gfx/small.png" alt=""> what would actually reference www.somesite.com/search/lang/en/str/monkeys/gfx/small.png, obviously not what you want. Don't use ../../ to solve this, it just gets silly instead try <img src="/gfx/small.png" alt="">
Hope this helps someone.
Awesome article. One of the most straightforward and easy to implement I have found.
Thank you. Very simple.
Excellent read! Wow, I am going to be researching more about this. Thank you!
Use ModRewrite!!
That's the right way!!
Never, never, never use the "404 error handler" method. It wouldn't work with suphp or php as cgi, the 404 headers would be already sent and all pages would be actually served as 404 errors.
And most modern hostings use suphp or other suexec-like technique for user separation.
ModRewrite!
ModRewrite!
It works.
Hi,
I do have a problem with the PATH_INFO and the mod_rewrite solutions.
The problem is in both cases the same:
when I access
mysite.com/index.php/whatever/url
and on that generated page their is some code like
<a href="/whatever/anotherurl"> My browser points that to /whatever/whatever/anotherurl. The same for src="/..." with images and css/javascript files. (The browser thinks we are in the directory /whatever while in fact we are in the / directory.)
Ofcourse this renders my site usable. What am I doing wrong?
Use <keyword>.html for better search engine ranking results
Search engine looks at /words/another/word/
as a directory structure and will find "word" at the last as least important
lClbLj hi! this is
Hello,
Thanks for this article! very helpful...however, with the ForceType directive, I lose all the formatting and styling on my script page. Can this be fixed?
Thanks for this information ......uts very userfull.....
Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums




ForceType doesn't seems to work (apache 2.2 / php 5.1.6)
i tried
Any more suggestions?Code:<Files tag> #ForceType application/x-httpd-php #SetHandler application/x-httpd-php #SetHandler application/x-httpd-php5 #ForceType x-httpd-php #ForceType application/x-httpd-php5 #AddHandler application/x-httpd-php5 .php ForceType php5-cgi </Files>
Hm. Solution 3 does not seem to work for me either (apache 2.2, PHP 5.2.9, WindowsXPSP3).
I've put the 3 lines in .htaccess, created a "test" file with only "<?php phpinfo(); ?>" in that same directory, but I keep getting that exact text instead of the PHP info.
Hello ... I implemented method 2 but for some strange reason google didn't index my pages? Is it really safe to implement it. It only indexed the home page and some pages with a .php extension
site:ad-traxx.com
I have tried method 2 a number of times. It works well but the irony is, pages using this method are not indexed by search engines.
Search Engine Friendly? hmmm
I have checked a couple on unimportant sites which have been live for over a year and only the static pages ending with .php are indexed, the dynamic stuff is not.
Also Google Webmaster Tools reports each dynamic page as a 404 error.
And most auto sitmap generating tools also report these pages as errrors and usually fail to include them in their output.
Looks like I'm gonna have to try mod-rewrite.
try out this one for mod rewrite:
It recursively iterates over the request and replaces 'field/val/' with 'field = val'. I don't know if it is technically SEO index friendly or not though.Code:RewriteEngine On RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*/)?([^/]+)/([^/]+) $1?$2=$3&%1 [L] RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^.*$ index.php?%1 [L]
Interestingly enough my re-write script was really simple and because I was already using $_SERVER('REQUEST_URI) to extract and then later explode the url into chuncks, I didnt even have to modify my original page handler.
I simply send the data in the same format but mod-rewite avoids having to send a 404 error back to the user:
ErrorDocument 404 /error.php
RewriteEngine on
#news index
RewriteRule ^latest-news/ myPageHandlerScript.php
RewriteRule ^latest-news myPageHandlerScript.php
#news details
RewriteRule ^latest-news/article/([a-zA-Z&0-9-.:@]+)/([0-9]+) myPageHandlerScript.php
#news pagination
RewriteRule ^latest-news/([0-9]+)/([0-9]+)/([0-9]+) myPageHandlerScript.php
#projects
RewriteRule ^our-work/([a-zA-Z&0-9-.:@]+)/([a-zA-Z&0-9-.:@]+)/([0-9]+) myPageHandlerScript.php
#services
RewriteRule ^our-services/ myPageHandlerScript.php
#services details
RewriteRule ^our-services/([a-zA-Z&0-9-.:@]+)/([0-9]+) myPageHandlerScript.php
#services details
RewriteRule ^sitemap/ sitemap.php
RewriteRule ^sitemap sitemap.php
etc
It works really well, XML generatin works perfectly now and presents no unexpected errors, this one is SEO friendly throughout.
You can see it in action here: http://www.bigwebcompany.co..uk
Bookmarks