Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:03:40+00:00 2026-06-03T07:03:40+00:00

I have some mod rewrite which will remove the .php and format a certain

  • 0

I have some mod rewrite which will remove the .php and format a certain page called county.php.

My problem is with the part that rewrites the county.php. I have to put a ‘/’ in front of all the links to css, images and js files. This causes problems on other parts of the site as I use php includes. Is there away around this? Thanks

RewriteEngine On
RewriteRule ^county/([^/\.]+)/?$ county.php?county_id=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:03:41+00:00Added an answer on June 3, 2026 at 7:03 am

    If you are using mod_rewrite to create virtual folders you have to deal with different folder names for all additional media types (CSS, JS, images …). To deal with a dynamic number of folders or even some pages with folders and some without makes it more complicated.

    I see following ways to solve that:

    1. use always the same number of folders (folder depth) – or

    2. do not use / character for separating parameters (e.g. “county_xzy”) – or

    3. create mod_rewrite rules for your media files as well

    Example:

    RewriteEngine On
    RewriteRule .*/(.*?)\.css$ css/$1.css
    RewriteRule .*/(.*?)\.js$ js/$1.js
    RewriteRule .*/(.*?)\.(jpg|jpeg|png|gif)$ images/$1.$2
    RewriteRule ^county/([^/\.]+)/?$ county.php?county_id=$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (.*) $1.php
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some php script updater.php which does some job for 1-2 minutes. Finishing
I am creating a file which will have some details in it, and I
I use .htaccess Mod Rewrite to send the URL to index.php, which then parses
We have a PHP app with a dynamic URL scheme which requires characters to
I am wanting to use mod-rewrite for cleaner URL's across my whole site which
I have some difficulties with the mod_rewrite rules. I want to rewrite any request
I have some mod_rewrite rewrites that correctly redirect the URLs to a script. From
I am complete newbie in mod_rewrite , and I have been going through some
I have some problems with mod_rewrited at .httacess. We have created a website, the
I am using Tomcat 6 and have some questions about Apache mod_jk as follows.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.