开发者

Url Rewrite problem: Cannot access my session and images from my re-written url

开发者 https://www.devze.com 2023-04-06 03:57 出处:网络
I used this rule on my site: <IfModule mod_rewrite.c> Options +FollowSymlinks Options -Multiviews RewriteEngine on

I used this rule on my site:

<IfModule mod_rewrite.c>
   Options +FollowSymlinks
    Options -Multiviews
    RewriteEngine on
    RewriteBase /

    RewriteCond %{HTTP_HOST} ^www.erecruitmentportal.com$
    RewriteRule ^(.*) http://erecruitmentportal.com/$1 [QSA,R=301]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)/?$ employers/page.php?page=$1 [L]
</IfModule>

When when one logs into the website, it sets a session only in the /employers/ directory. This means that only files in that directory can access the session.

Now after rewriting urls from http://example.com/name to http://example.com/employers/page.php?page=$1,

  1. i cannot access my sessions again
  2. in the employers folder, i have a folder - logos, now i cant access logos/pic.jpg from page.php (thats the url-rewritten version). It still sees the page from the root.

I am thinking its a rewrite base issue, so how do i modify this so it will work well for this, and not affect other rules that may follow.

Thanks

EDIT

This is my session settings:

session_start();
session_set_cookie_params ( $this->sessiontimeout, $this->subdomain, $this->website, 0, 1 );
//i want the session to be available only to files in a particular folder
ini_set('session.use_only_cookies', 1);
开发者_如何学JAVA


for the pictures you have to addres them as /employers/logos/pic.jpg

as for the sessions you're using it awfully wrong.
check permissions using some code logic, not clumsy HTTP requests.

Let your sessions to be available everywhere but check these sessions only in them files in a particular folder


in your page header add base url like http://example.com/mysite in between your head tag. dont put www in ur base url.this is where ur page will start loading from

0

精彩评论

暂无评论...
验证码 换一张
取 消