Pregunta

I have a code to redirect all users to soon.php except those with certain page should see the content in .htaccess ..

The code looks like this:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !=10.10.10.10
RewriteCond %{REQUEST_URI} !^/soon\.php$
RewriteRule ^(.*)$ http://example.com/soon.php [R=307,L]

But when i look at soon.php the images and fonts are missing which are located in another subfolder named

/soon/images
/soon/fonts

How can i give soon.php which is in root directory access to those directories?

¿Fue útil?

Solución

Try excluding requests with a certain referer:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !=10.10.10.10
RewriteCond %{REQUEST_URI} !^/soon\.php$
RewriteCond %{HTTP_REFERER} !soon\.php
RewriteRule ^(.*)$ http://example.com/soon.php [R=307,L]

Or, just exclude the /soon/ directory:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !=10.10.10.10
RewriteCond %{REQUEST_URI} !^/soon\.php$
RewriteCond %{REQUEST_URI} !^/soon/
RewriteRule ^(.*)$ http://example.com/soon.php [R=307,L]
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top