This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Mod_Rewrite support
#1

Hello, just a quick request.
Since i use the mod rewrite function of apache there seemed to occur some complications with commentics.
For example if a site where you want to have commentics is in the directory http://domain.com/dir1/dir2/file.php but you made a redirect via mod rewirte to http://domain.com/redirect/ Commetics will use the first path to process the comment submission so that the user will se in the adress bar the full directories.
What i did was to replace every $_SERVER['PHP_SELF'] with $_SERVER['REQUEST_URI'] in includes/functions/comments.php and includes/template/form.php.

For me it worked till now, but maybe you find a better solution...?
regards
Reply
#2

Hi,

The solution of replacing $_SERVER['PHP_SELF'] with $_SERVER['REQUEST_URI'] will work with regards to mod_rewrite but it will cause problems with the retention of query parameters in the URL. This is because $_SERVER['REQUEST_URI'] includes any query parameters in the URL, whereas $_SERVER['PHP_SELF'] doesn't, so as a result of your change you may see query parameters in the URL twice. A better solution is to still use $_SERVER['REQUEST_URI'] but to remove any query parameters from it.

So instead of this:
PHP Code:
<?php 
htmlentities
($_SERVER['PHP_SELF'])

Replace it with this:
PHP Code:
<?php 
htmlentities
(strtok($_SERVER['REQUEST_URI'], "?"))

Have you completed the interview?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by jreyest
10-Jun-2016, 03:39 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)