Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Oct 2011
    Posts
    237
    Thanks
    11
    Thanked 5 Times in 5 Posts

    mod_rewrite problem

    Hi guys i am trying to get the website url to show

    www.domain.com/edit-blog/username/blogId

    i am using the rule

    PHP Code:
    RewriteRule ^edit-blog/([A-Za-z0-9-]+)/([0-9]+)/?$ users/add-blog.php?username=$1&mode=edit&id=$[L
    the mod rewrite works but for some reason its only showing the html, no styles, images or javascripting. So i assume the rewrite is wrong?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    So i assume the rewrite is wrong?
    You may easily get it resolved by the use of absolute paths to link files.
    Have a look at CSS, Div,Linking
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Oct 2011
    Posts
    237
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by abduraooft View Post
    You may easily get it resolved by the use of absolute paths to link files.
    Have a look at CSS, Div,Linking
    For some reason that is bringing up page can not be found, if i use absolute, but that may be because i am in localhost on my computer working through wamp which means my absolute url is as follows:

    localhost/folder/etc etc

  • #4
    Regular Coder
    Join Date
    Oct 2011
    Posts
    237
    Thanks
    11
    Thanked 5 Times in 5 Posts
    The problem only arises when i ad a new rule.

    For instance if i have

    www.domain.com/edit-blog/$1

    its fine but as soon as do this it then goes wrong

    www.domain.com/edit-blog/$1/$2

    Even if i add the NC within it, it does not work correctly

    PHP Code:
    RewriteRule ^edit-blog/([A-Za-z0-9-]+)/([0-9]+)/?$ users/add-blog.php?username=$1&mode=edit&id=$[NC,L
    Last edited by devinmaking; 10-06-2011 at 10:47 AM.

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by devinmaking View Post
    For some reason that is bringing up page can not be found, if i use absolute, but that may be because i am in localhost on my computer working through wamp which means my absolute url is as follows:

    localhost/folder/etc etc
    Create a virtual host under your local development environment to simplify the things. Check virtual host on development environment to see how to do this on xampp
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by devinmaking View Post
    The problem only arises when i ad a new rule.

    For instance if i have

    www.domain.com/edit-blog/$1

    its fine but as soon as do this it then goes wrong

    www.domain.com/edit-blog/$1/$2

    Even if i add the NC within it, it does not work correctly

    PHP Code:
    RewriteRule ^edit-blog/([A-Za-z0-9-]+)/([0-9]+)/?$ users/add-blog.php?username=$1&mode=edit&id=$[NC,L
    Yes, I had encountered this before and I know it very well. Each of the slashes in your rewritten url will be considered as a sub-folder by the browser, which makes the files linked using the relative paths inaccessible.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #7
    Regular Coder
    Join Date
    Oct 2011
    Posts
    237
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by abduraooft View Post
    Yes, I had encountered this before and I know it very well. Each of the slashes in your rewritten url will be considered as a sub-folder by the browser, which makes the files linked using the relative paths inaccessible.
    I have tried to do this using the .htacess

    Stating the absolute url is:

    RewriteBase /uaf/

    But for some reason that has not cured the problem, for some reason www.domain.com/folder1/username works but as soon as i add another folder it doesnt want to:

    www.domain.com/folder1/folder2/blogid

    Any ideas?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •