I
I
ingenerdsm2014-02-12 11:16:01
htaccess
ingenerdsm, 2014-02-12 11:16:01

Is there a solution via htaccess?

Task: remove the folder address from the url
At the root of the site is a folder - folder, it in turn contains two files:
1) index.php
2) style file - style.css
Accordingly, index.php is available at site.com/folder /index.php Since the style file is on the same level as the index file,
it is included via a relative path -

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

I need to remove the folder name from the url, that is, get the following from site.com/folder/index.php : site.com/index.php
When performing the following actions in htaccess, the page becomes available at a new address, BUT the style file stops connecting, now it
is connected along the path site.com/style.css (and of course it is not there, because it is in the folder folder)
RewriteEngine On

RewriteBase /

RewriteRule ^index.php$ folder/index.php [NC,L]

What needs to be added to htaccess so that the path to the css file does not change? I don’t want to just change the relative path to /folder/style.css, because the task is to hide the folder.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kompi, 2014-02-12
@kompi

Try:RewriteBase /folder/

G
gro, 2014-02-12
@gro

Didn't understand.
If you change the address of index, but do not change the address for css, then you still have to specify folder when connecting.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question