I'm trying to replace a PHP query string with virtual directories using
Apache's mod_rewrite. Here's my test .htaccess:
RewriteEngine on
RewriteRule ^qqq$ database.php?ca t=0
RewriteRule ^qqq/xxx$ database.php?ca t=0
The problem is that database.php contains several relative paths to
images. This means mydomain/qqq works fine and all the images are found
but when typing mydomain/qqq/xxx the file database.php seems to think it
is in the xxx directory and cannot find the images.
What, apart from not using relative paths in database.php, can be done
to make things work correctly so that database.php always thinks it is
in the root directory and finds the images?
Regards
R. 3 1974
Rik G. wrote: I'm trying to replace a PHP query string with virtual directories using Apache's mod_rewrite. Here's my test .htaccess:
RewriteEngine on RewriteRule ^qqq$ database.php?ca t=0 RewriteRule ^qqq/xxx$ database.php?ca t=0
The problem is that database.php contains several relative paths to images. This means mydomain/qqq works fine and all the images are found but when typing mydomain/qqq/xxx the file database.php seems to think it is in the xxx directory and cannot find the images.
What, apart from not using relative paths in database.php, can be done to make things work correctly so that database.php always thinks it is in the root directory and finds the images?
Regards
R.
Methnks that question might be better in alt.apache.conf iguration or even
over at http://www.mod-rewrite.com/forum/
Rik G. wrote: What, apart from not using relative paths in database.php, can be done to make things work correctly so that database.php always thinks it is in the root directory and finds the images?
Define your image directory in .htaccess:
RewriteRule ^qqq/images/(.*)$ images/$1
regards,
Lorento
-- http://blog.deshot.com http://www.groupvita.com
lorento wrote: Rik G. wrote: What, apart from not using relative paths in database.php, can be done to make things work correctly so that database.php always thinks it is in the root directory and finds the images?
Define your image directory in .htaccess:
RewriteRule ^qqq/images/(.*)$ images/$1
regards,
Lorento -- http://blog.deshot.com http://www.groupvita.com
Thank you, that does the trick.
R. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Support |
last post by:
Hello,
I am running RedHat & Apache. RedHat does not allow creating more
that 32000 subdirectories in one folder due to #defined constant
limitation in the core code.
I need to display 47000 directories on web page:
e.g. mydomain.com/andrew , mydomain.com/bill , etc. Each directory
contains .html/htm files and image files (*.jpg, *gif, jpeg etc.)
|
by: laredotornado |
last post by:
Hi,
I have verified that mod_rewrite is enabled on my Apache 2.2 instance.
However, now I'm having a problem just serving pages using .htaccess
files. Following Rik's advice, my .htaccess file is as follows
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !^accesscontrol.php
|
by: narian |
last post by:
Hi,
I am trying to convert urls from this format:
http://localhost/index.php?section=11 (where 11 is the id of the row in a table)
to this friendly url:
http://localhost/services.html (where 'services' is the sef id in the same row of the table)
|
by: jaimebienlesfruits |
last post by:
Hi,
I'm currently using mod_rewrite to rewrite URLs with server variables.
RewriteEngine on
RewriteRule ^(+)$ /layout4/$1/
RewriteRule ^(+)/?$ index.php?dir=&page=$1
RewriteRule ^(+)/(+)$ /layout4/$1/$2/
RewriteRule ^(+)/(+)/?$ index.php?dir=$1&page=$2
|
by: jaanus |
last post by:
Here we go...
What I have been trying to do is to forward all http requests containing /cms/ to http://cms.mydomain.com/
example1: http://host1.mydomain.com/cms/init.php would be parsed from http://cms.mydomain.com/init.php (via ajax request)
example2: <script src="http://host1.mydomain.com/cms/example.js" in <html><head> would be parsed from http://cms.mydomain.com/example.js
physically there are no cms directories in...
| |
by: Kevin Audleman |
last post by:
When you type in a url without a filename, e.g. www.google.com/, it
automatically looks for index.php (or whatever your web server is
configured to look for). I am having the problem where my CMS is
returning a page not found in this case.
Try typing in http://www.quick2m.com/izzy -- you get 404
Try typing in http://www.quick2m.com/izzy/index.php -- you get the
homepage
Is this something I can fix with mod_rewrite? How would I write a...
|
by: macaco |
last post by:
I'd like to redirect URLs in a directory in this way:
categories/anything/index.php?id=13 to
categories/index.php?id=13
To achieve that, I've uploaded a .htaccess file to "categories" directory that contains the following:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
|
by: LC's No-Spam Newsreading account |
last post by:
On Tue, 7 Oct 2008, Grant wrote:
I carefully RTFM, but can't find an example like my case.
What is the " fake directory cgi option" ?
(in general I avoid using /cgi-bin or personal /user-bin and tend to use
local CGIs in the same directory as the rest of the pages)
|
by: cptuser |
last post by:
Hi,
I'm struggling to find an answer to my problem. In order to make my dynamic URLs search engine friendly, I need to replace spaces (%20) that appear in the URL with a dash "-".
For example,
change this dynamic URL:
www.example.com/directory.php?name=very%20nice%20house
to simply: www.example.com/very-nice-house
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |