problem with mod_rewrite

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    problem with mod_rewrite

    Hey guys,

    as stated in one of my posts/threads before i am working on a wap/web community and im getting quite forward with it, my problem now is i use mod_rewrite to make the url friendly

    for example i have this

    PHP Code:
    Options +FollowSymlinks
    RewriteEngine on
    DirectorySlash on
    ErrorDocument 404 http
    ://domain.com/wap/error.php
    RewriteRule ^users/([0-9]+)-([a-z]+) users.php?id=$[NC
    this makes profiles available like http://domain.com/wap/users/?id=1 now the problem is if i open the profile like http://domain.com/wap/users?id=1 my theme messes up incase it wont load at all because the path is messed, now i am looking for a way to force the leading / with mod_rewrite or if needed even with php is there any way to do that?

    PHP Code:
    foreach ($_SERVER as $server => $value)
    {
    echo 
    "$server is $value<br />";


    #2
    edit css, images set the full path ex http://site link/dir/image and do same with css url at the page

    Comment


      #3
      Thats what i am doing right now but its not the best way to do i am looking for an alternative way

      Added after 21 minutes:

      okay i came up with this
      PHP Code:
      RewriteCond %{REQUEST_URI} !(.*)/$
      RewriteRule ^(.*)$ $1/ [L,R=301
      but this puts a trailing slash to the .css aswell and therefore makes it unusable
      Last edited by djdevil89; 15.07.11, 20:55.

      PHP Code:
      foreach ($_SERVER as $server => $value)
      {
      echo 
      "$server is $value<br />";

      Comment


        #4
        Originally posted by DjMatrix View Post
        Thats what i am doing right now but its not the best way to do i am looking for an alternative way
        theres nothing like the "best way", whether its the absolute url path to d style sheet, or just the relative path, it still sends a new independent request for d the css externally

        Comment


          #5
          you are using a re-director and that is what is giving you error. You will have to edit all prevalent links in the script.
          tinyurl.com/earnbymobile
          Easy earning for Indians
          ---------------------
          Alternative mobile advertising network .. Minimum 100 USD pay / NET15 pay cycle, Good Brand, Best targeting for Android
          goo.gl/6vub3

          Comment


            #6
            FYI, this way makes ur page faster ;)

            Comment


              #7
              Originally posted by morse View Post
              you are using a re-director and that is what is giving you error. You will have to edit all prevalent links in the script.
              thanks fpr pointing that out so what you think the htaccess code should be like?

              PHP Code:
              foreach ($_SERVER as $server => $value)
              {
              echo 
              "$server is $value<br />";

              Comment


                #8
                Originally posted by DjMatrix View Post
                thanks fpr pointing that out so what you think the htaccess code should be like?
                R=301 is a redirector , right ?? remove it problem solved . But then you have to manually edit each and every link in the web page to its absoluteness for you to have links pointed to right pages.
                tinyurl.com/earnbymobile
                Easy earning for Indians
                ---------------------
                Alternative mobile advertising network .. Minimum 100 USD pay / NET15 pay cycle, Good Brand, Best targeting for Android
                goo.gl/6vub3

                Comment


                  #9
                  okay i have it thanks a lot
                  i didnt remove the redirect but went and removed the trailing slash on images and css using preg_replace
                  Last edited by djdevil89; 16.07.11, 14:24.

                  PHP Code:
                  foreach ($_SERVER as $server => $value)
                  {
                  echo 
                  "$server is $value<br />";

                  Comment

                  Working...
                  X