www.webdeveloper.com
Results 1 to 2 of 2

Thread: mod rewrite how to set up relative links

  1. #1
    Join Date
    Apr 2011
    Posts
    1

    mod rewrite how to set up relative links

    Hi I have a problem. I need to do a redirection of all requests to index page. The problem is that when I exclude the css/js from the rule the server is trying to resolve the relative path from the address inputed in the browser.
    Example of problem path:mydomain.com/category/product

    Since index is in main directory the relative paths are resolving as they should only with url like: mydomain.com/category
    Is there a quick fix to this?

    .htaccess
    Code:
    Options FollowSymLinks
    RewriteEngine On
    
    # ignore anything that's an actual file (eg CSS, js, images)
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    
    # redirect all other traffic to the index page
    RewriteRule . index.php [L]

  2. #2
    Join Date
    Apr 2010
    Posts
    88
    You can use absolute paths.
    ps. You need one more RewriteCond to ignore directories.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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
  •  
HTML5 Development Center



Recent Articles