RewriteRule-дать доступ к папке

Я использую RewriteRule, чтобы сократить ссылки ?s=xxx to / xxx-но у меня есть некоторые проблемы, которые я не могу получить доступ к файлам в некоторых папках. Чтобы помочь с этим у меня есть сделать исключение в правиле как:

RewriteRule ^(inv.*) 

I use RewriteRule to shorten the links from ?s=xxx to /xxx - but I have some problems that I cant access files in some folders. To help with that I have make an exception in the rule as:

RewriteRule ^(inv.*) $1 [L]

This because I have .pdf files in the folder "inv".

But the problem is that I also have some sites that is called /invitation. The problem is that this link gives 404 error.

If I remowe the line above, the /invitation works - but then I get 404 error on the /inv/xx.pdf.

How can I change the RewriteRule that makes both works.

Thanks.

This is my entire .htaccess file:

DirectoryIndex i.php index.php index.html
RewriteEngine On
RewriteRule ^robots.txt - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule ^(inv.*) $1 [L]
RewriteRule ^([^/]+)/?$ /?s=$1 [NC,L]
RewriteRule ^(nyhet)/([^/]+)/?$ /?s=$1&n=$2 [NC,L]
RewriteRule ^([^/]+)/([^/]+)/?$ /?s=$1_$2 [NC,L]
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 403 http://www.domain.com/404

[L]

Это потому что у меня .pdf файлы в папке «inv».

Но проблема в том, что у меня также есть некоторые сайты, которые называются /invitation. Проблема в том, что эта ссылка дает ошибку 404.

Если я повторяю строку выше, / invitation работает — но тогда я получаю ошибку 404 на /inv / xx.pdf.

Как я могу изменить переписчик, который делает обе работы.

Спасибо.

Это все мое .htaccess файл:

DirectoryIndex i.php index.php index.html
RewriteEngine On
RewriteRule ^robots.txt - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(wp-(content|admin|includes).*) 

I use RewriteRule to shorten the links from ?s=xxx to /xxx - but I have some problems that I cant access files in some folders. To help with that I have make an exception in the rule as:

RewriteRule ^(inv.*) $1 [L]

This because I have .pdf files in the folder "inv".

But the problem is that I also have some sites that is called /invitation. The problem is that this link gives 404 error.

If I remowe the line above, the /invitation works - but then I get 404 error on the /inv/xx.pdf.

How can I change the RewriteRule that makes both works.

Thanks.

This is my entire .htaccess file:

DirectoryIndex i.php index.php index.html
RewriteEngine On
RewriteRule ^robots.txt - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule ^(inv.*) $1 [L]
RewriteRule ^([^/]+)/?$ /?s=$1 [NC,L]
RewriteRule ^(nyhet)/([^/]+)/?$ /?s=$1&n=$2 [NC,L]
RewriteRule ^([^/]+)/([^/]+)/?$ /?s=$1_$2 [NC,L]
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 403 http://www.domain.com/404

[L]
RewriteRule ^(.*.php)$

I use RewriteRule to shorten the links from ?s=xxx to /xxx - but I have some problems that I cant access files in some folders. To help with that I have make an exception in the rule as:

RewriteRule ^(inv.*) $1 [L]

This because I have .pdf files in the folder "inv".

But the problem is that I also have some sites that is called /invitation. The problem is that this link gives 404 error.

If I remowe the line above, the /invitation works - but then I get 404 error on the /inv/xx.pdf.

How can I change the RewriteRule that makes both works.

Thanks.

This is my entire .htaccess file:

DirectoryIndex i.php index.php index.html
RewriteEngine On
RewriteRule ^robots.txt - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule ^(inv.*) $1 [L]
RewriteRule ^([^/]+)/?$ /?s=$1 [NC,L]
RewriteRule ^(nyhet)/([^/]+)/?$ /?s=$1&n=$2 [NC,L]
RewriteRule ^([^/]+)/([^/]+)/?$ /?s=$1_$2 [NC,L]
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 403 http://www.domain.com/404

[L]
RewriteRule ^(inv.*)

I use RewriteRule to shorten the links from ?s=xxx to /xxx - but I have some problems that I cant access files in some folders. To help with that I have make an exception in the rule as:

RewriteRule ^(inv.*) $1 [L]

This because I have .pdf files in the folder "inv".

But the problem is that I also have some sites that is called /invitation. The problem is that this link gives 404 error.

If I remowe the line above, the /invitation works - but then I get 404 error on the /inv/xx.pdf.

How can I change the RewriteRule that makes both works.

Thanks.

This is my entire .htaccess file:

DirectoryIndex i.php index.php index.html
RewriteEngine On
RewriteRule ^robots.txt - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule ^(inv.*) $1 [L]
RewriteRule ^([^/]+)/?$ /?s=$1 [NC,L]
RewriteRule ^(nyhet)/([^/]+)/?$ /?s=$1&n=$2 [NC,L]
RewriteRule ^([^/]+)/([^/]+)/?$ /?s=$1_$2 [NC,L]
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 403 http://www.domain.com/404

[L]
RewriteRule ^([^/]+)/?$ /?s=

I use RewriteRule to shorten the links from ?s=xxx to /xxx - but I have some problems that I cant access files in some folders. To help with that I have make an exception in the rule as:

RewriteRule ^(inv.*) $1 [L]

This because I have .pdf files in the folder "inv".

But the problem is that I also have some sites that is called /invitation. The problem is that this link gives 404 error.

If I remowe the line above, the /invitation works - but then I get 404 error on the /inv/xx.pdf.

How can I change the RewriteRule that makes both works.

Thanks.

This is my entire .htaccess file:

DirectoryIndex i.php index.php index.html
RewriteEngine On
RewriteRule ^robots.txt - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule ^(inv.*) $1 [L]
RewriteRule ^([^/]+)/?$ /?s=$1 [NC,L]
RewriteRule ^(nyhet)/([^/]+)/?$ /?s=$1&n=$2 [NC,L]
RewriteRule ^([^/]+)/([^/]+)/?$ /?s=$1_$2 [NC,L]
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 403 http://www.domain.com/404

[NC,L]
RewriteRule ^(nyhet)/([^/]+)/?$ /?s=

I use RewriteRule to shorten the links from ?s=xxx to /xxx - but I have some problems that I cant access files in some folders. To help with that I have make an exception in the rule as:

RewriteRule ^(inv.*) $1 [L]

This because I have .pdf files in the folder "inv".

But the problem is that I also have some sites that is called /invitation. The problem is that this link gives 404 error.

If I remowe the line above, the /invitation works - but then I get 404 error on the /inv/xx.pdf.

How can I change the RewriteRule that makes both works.

Thanks.

This is my entire .htaccess file:

DirectoryIndex i.php index.php index.html
RewriteEngine On
RewriteRule ^robots.txt - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule ^(inv.*) $1 [L]
RewriteRule ^([^/]+)/?$ /?s=$1 [NC,L]
RewriteRule ^(nyhet)/([^/]+)/?$ /?s=$1&n=$2 [NC,L]
RewriteRule ^([^/]+)/([^/]+)/?$ /?s=$1_$2 [NC,L]
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 403 http://www.domain.com/404

&n= [NC,L]
RewriteRule ^([^/]+)/([^/]+)/?$ /?s=

I use RewriteRule to shorten the links from ?s=xxx to /xxx - but I have some problems that I cant access files in some folders. To help with that I have make an exception in the rule as:

RewriteRule ^(inv.*) $1 [L]

This because I have .pdf files in the folder "inv".

But the problem is that I also have some sites that is called /invitation. The problem is that this link gives 404 error.

If I remowe the line above, the /invitation works - but then I get 404 error on the /inv/xx.pdf.

How can I change the RewriteRule that makes both works.

Thanks.

This is my entire .htaccess file:

DirectoryIndex i.php index.php index.html
RewriteEngine On
RewriteRule ^robots.txt - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule ^(inv.*) $1 [L]
RewriteRule ^([^/]+)/?$ /?s=$1 [NC,L]
RewriteRule ^(nyhet)/([^/]+)/?$ /?s=$1&n=$2 [NC,L]
RewriteRule ^([^/]+)/([^/]+)/?$ /?s=$1_$2 [NC,L]
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 403 http://www.domain.com/404

_ [NC,L]
ErrorDocument 404 http://www.domain.com/404
ErrorDocument 403 http://www.domain.com/404

1 ответ

  1. отключить reportory contenu by

    Options All -Indexes 
    

    затем исправить правила файлов

    <Files ~ "([.][^][*])^.*\.">
    order allow,deny
    deny from all
    satisfy all
    </Files>