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

  • Home
  • SEARCH
  • 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 8537295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:52:04+00:00 2026-06-11T10:52:04+00:00

I am using following mod_rewrite rule: **RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f RewriteRule ^(.*)$ $1.php [L]** to

  • 0

I am using following mod_rewrite rule:

  **RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
    RewriteRule ^(.*)$ $1.php [L]**

to get clean url such as

  www.myweb.com/login

from

 www.myweb.com/login.php

I am using another rewrite rule

**RewriteRule ^itemdetail/([0-9]+)/?$ itemdetail.php?itemid=$1 [NC,L]**

to get

 www.myweb.com/itemdetail/100008

from

 www.myweb.com/itemdetail?itemid=100008.

This works fine but there is one problem. This rewrite rule add a subdomain on every link. for example. if the link to css file is text.css now the link to this css file is itemdetail/text.css. The link to home page is now http://www.myweb.com/itemdetail/home instead of http://www.myweb.com/home. What am I doing wrong here. Please help.

  • 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-11T10:52:05+00:00Added an answer on June 11, 2026 at 10:52 am

    This rewrite rule add a subdomain on every link. for example. if the link to css file is text.css now the link to this css file is itemdetail/text.css. The link to home page is now http://www.myweb.com/itemdetail/home instead of http://www.myweb.com/home. What am I doing wrong here.

    You can do one of two things to deal with this, either add this to the header of your itemdetail.php pages (inside the <head> </head> tags):

    <base href="/">
    

    Or you can change your css links from relative to absolute URLs by adding a leading /, example:

    <link rel="stylesheet" href="/text.css" type="text/css">
    

    Otherwise, you could try adding rewrite rules to un-write the css links, but that’s usually a really bad idea, as it’ll break css in subdirectories when you are intentionally using them:

    RewriteRule ^itemdetail/(.*?)\.css$ /$1.css [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following rewrite rule, but I can't get it to work: RewriteRule
I'm using following chunk of instructions to rewrite www to non www url: <IfModule
Using mod_rewrite, what RewriteRule(s) would make the following two examples function properly? Example #1
I am using mod_rewrite to remap the URLs in my website in the following
Using following code I try to get updated list of checkbuttons' corresponding text values,
I have a list of URLs such as, http://www.mywebsite.com/page.php?genus=A_GENUS&species=A_SPECIES&id=12345 . I would like to
We have the following mod_rewrite condition/rule but it is returning a 404 error on
I currently have the following htaccess <IfModule mod_rewrite.c> # redirect all calls to index.php
I'm using apache's mod_rewrite to make my application's URL's pretty. I have the basics
I am using WordPress's permalink structure %category%/%postname%/ with the following htaccess: <IfModule mod_rewrite.c> RewriteEngine

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.