I have:
RewriteRule ^([^.]+)/([^.]+)$ ?language=$1&title=$2 [NC]
rewrites domain.com/index?language=en&title=home to domain.com/en/home
Problem: to link to css-files, images etc I have to use '../' to go
into an upper folder, while this shouldn't be necessary. It is because
of de 'folder' 'en' which is in the address field of the browser.
Is there a possibility to resolve this?
Using '/' does not help, because the web app is not in the root.
Thanks in advance 7 3062
On Nov 9, 9:05*am, betty <123be...@gmail.comwrote:
I have:
RewriteRule ^([^.]+)/([^.]+)$ ?language=$1&title=$2 [NC]
rewrites domain.com/index?language=en&title=home to domain.com/en/home
Problem: to link to css-files, images etc I have to use '../' to go
into an upper folder, while this shouldn't be necessary. It is because
of de 'folder' 'en' which is in the address field of the browser.
Is there a possibility to resolve this?
Using '/' does not help, because the web app is not in the root.
Thanks in advance
Add this before the RewriteRule. It will effectively exclude files and
directories from the rewrite:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
By the way, it may be easier for you to just use this RewriteRule:
RewriteRule ^(.*)$ index.php?query=$1 [L,QSA]
And parse $_GET['query'] using PHP. That's definitely more flexible.
Thomas
On Nov 9, 3:58*pm, 703designs <thomasmal...@gmail.comwrote:
Add this before the RewriteRule. It will effectively exclude files and
directories from the rewrite:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
By the way, it may be easier for you to just use this RewriteRule:
RewriteRule ^(.*)$ index.php?query=$1 [L,QSA]
And parse $_GET['query'] using PHP. That's definitely more flexible.
Thomas
Thank you for your answer.
If I use RewriteCond, I still am having problems with linking files
like css.
Could you tell me how I would be able to 'parse $_GET['query'] using
PHP'? By looking for '/' and extract the values, or is there a better
way to do that?
Is it true that I still would need the RewriteCond?
On Nov 9, 3:58*pm, 703designs <thomasmal...@gmail.comwrote:
On Nov 9, 9:05*am, betty <123be...@gmail.comwrote:
I have:
RewriteRule ^([^.]+)/([^.]+)$ ?language=$1&title=$2 [NC]
rewrites domain.com/index?language=en&title=home to domain.com/en/home
Problem: to link to css-files, images etc I have to use '../' to go
into an upper folder, while this shouldn't be necessary. It is because
of de 'folder' 'en' which is in the address field of the browser.
Is there a possibility to resolve this?
Using '/' does not help, because the web app is not in the root.
Thanks in advance
Add this before the RewriteRule. It will effectively exclude files and
directories from the rewrite:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
By the way, it may be easier for you to just use this RewriteRule:
RewriteRule ^(.*)$ index.php?query=$1 [L,QSA]
And parse $_GET['query'] using PHP. That's definitely more flexible.
Thomas
On Nov 9, 3:58 pm, 703designs <thomasmal...@gmail.comwrote:
Add this before the RewriteRule. It will effectively exclude files and
directories from the rewrite:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
By the way, it may be easier for you to just use this RewriteRule:
RewriteRule ^(.*)$ index.php?query=$1 [L,QSA]
And parse $_GET['query'] using PHP. That's definitely more flexible.
Thomas
Thank you for your answer.
If I use RewriteCond, I still am having problems with linking files
like css.
With using ?language=$1&title=$2 I can extract the value language by
doing $_GET['language'].
Could you tell me how I would be able to 'parse $_GET['query'] using
PHP'? By looking for '/' and extract the values, or is there a better
way to do that?
Is it true that I still would need the RewriteCond?
On Nov 9, 10:31*am, betty <123be...@gmail.comwrote:
On Nov 9, 3:58*pm, 703designs <thomasmal...@gmail.comwrote:
On Nov 9, 9:05*am, betty <123be...@gmail.comwrote:
I have:
RewriteRule ^([^.]+)/([^.]+)$ ?language=$1&title=$2 [NC]
rewrites domain.com/index?language=en&title=home to domain.com/en/home
Problem: to link to css-files, images etc I have to use '../' to go
into an upper folder, while this shouldn't be necessary. It is because
of de 'folder' 'en' which is in the address field of the browser.
Is there a possibility to resolve this?
Using '/' does not help, because the web app is not in the root.
Thanks in advance
Add this before the RewriteRule. It will effectively exclude files and
directories from the rewrite:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
By the way, it may be easier for you to just use this RewriteRule:
RewriteRule ^(.*)$ index.php?query=$1 [L,QSA]
And parse $_GET['query'] using PHP. That's definitely more flexible.
Thomas
On Nov 9, 3:58 pm, 703designs <thomasmal...@gmail.comwrote:
Add this before the RewriteRule. It will effectively exclude files and
directories from the rewrite:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
By the way, it may be easier for you to just use this RewriteRule:
RewriteRule ^(.*)$ index.php?query=$1 [L,QSA]
And parse $_GET['query'] using PHP. That's definitely more flexible.
Thomas
Thank you for your answer.
If I use RewriteCond, I still am having problems with linking files
like css.
With using ?language=$1&title=$2 I can extract the value language by
doing $_GET['language'].
Could you tell me how I would be able to 'parse $_GET['query'] using
PHP'? By looking for '/' and extract the values, or is there a better
way to do that?
Is it true that I still would need the RewriteCond?
I think that the easiest way is to use split, as in:
$params = split("/", $_GET['query']); http://us3.php.net/split
In this case, URLs would be written like this:
/language/title
and be mapped to
/index.php?query=language/title
Thomas
betty escribió:
RewriteRule ^([^.]+)/([^.]+)$ ?language=$1&title=$2 [NC]
rewrites domain.com/index?language=en&title=home to domain.com/en/home
Problem: to link to css-files, images etc I have to use '../' to go
into an upper folder, while this shouldn't be necessary. It is because
of de 'folder' 'en' which is in the address field of the browser.
Is there a possibility to resolve this?
Using '/' does not help, because the web app is not in the root.
The browser doesn't know/care about the server's disk layout. If you add
slashes to the URL you *are* adding directory levels. So you have
several alternatives:
1. Replace slashes with anything else: http://example.com/en-home
2. Fix your relative URLs, adding "../" as you said; it *is* necessary.
3. Build absolute URLs. PHP is a programming language, it should not be
a big issue to replace / with the appropriate value for your system ;-)
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
betty wrote:
>I have:
RewriteRule ^([^.]+)/([^.]+)$ ?language=$1&title=$2 [NC]
I have had this problem ...
Just use <basehtml tag and problem should go away :-) Or use full URI in your
css include path etc.
Thanks to all for helping out.
I use now:
<base href="http://
<? echo $_SERVER['SERVER_NAME'];
echo substr($_SERVER['SCRIPT_NAME'], 0,
strrpos($_SERVER['SCRIPT_NAME'], '/'));
?>
/" />
<link rel="stylesheet" href="css/main.css" type="text/css" />
Using only <base /is not good: when moving the website to another
folder, I have to change <base />.
Using only PHP to find the root folder, isn't good too: I have to put
it everywhere in the file when linking to a file like css or image.
SO I'm using a combination of both.
Is using $_SERVER['SERVER_NAME'] and $_SERVER['SCRIPT_NAME'] the
safest? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Phil Powell |
last post by:
http://www.sitepoint.com/article/910/2]
How can it be possible to use Apache's mod_rewrite module in such a
way as to dynamically feed it variable information into the
"RewriteRule" option? I...
|
by: Stephen Kay |
last post by:
Is there a way to redirect every single page on an existing web site through
a php function?
In other words, say I have a whole functional HTML web site, never written
to use any php. Now I...
|
by: aljosa.mohorovic |
last post by:
..htaccess file:
RewriteRule ^test$ test.php
RewriteRule ^test\/(.*)$ test.php/$1
my guess is that result should be equal:
http://koncar.info/test.php/anything
http://koncar.info/test/anything...
|
by: Jon Maz |
last post by:
Hi,
I'm having problems with a RewriteRule that's applied to url's with the %
character in them, hope someone can help. The % character is a result of
url-encoding non-ASCII words, as in the...
|
by: RuthC |
last post by:
Hi, In my website there is a facility for user to create there own pages
we are maintaing this url as
www.mywebsite.com/mypage/user created page name
ex : www.mywebsite.com/mypage/ruth
user...
|
by: dheeraj4uuu |
last post by:
Hii
I have an Smf forum, and i installed SEO4SMF to my forum and i made some modifications to my htaccess file.but after doing so everything works fine
but i noticed that after going to some...
|
by: JackpipE |
last post by:
I need to rename a generic image to the name of the product that's
being viewed on the page:
/theme/images/fullProfile.gif to - /theme/images/
productxxx.jpg
The productxxx.jpg image...
|
by: macaco |
last post by:
I'm trying to achieve the following:
anydirectory/index.php?query_str --> anydirectory/index2.php?query_str
anydirectory/anysubdirectory/index3.php?query_str -->...
|
by: Claus Mygind |
last post by:
I have a helpDesk app. that sits on a server only accessible to our web users within our building. But we also have offices in other buildings through out the State.
I would like to give access...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |