I need some help to transform my static .htaccess
rule to a dynamic rule. This is the definition of the rule:
#Redirect the request of file inside folder 'agencias/pagina_agencia/' to the base root URL
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.avantitecnologiati.com.br
RewriteRule ^teste2 agencias/pagina_agencia/teste2.php [L,QSA]
Everytime when someone request the page: [www.avantitecnologiati.com.br/teste2] automatically the htaccess rule reads the file called "teste2.php" which are located at this path:[www.avantitecnologiati.com.br/agencias/pagina_agencia/teste2.php] everything working perfect right?
Nop, I got two problems ;(
- I need to create a new line everytime I add a new file inside the folder called "agencias/pagina_agencia/", something like:
RewriteRule ^teste3 agencias/pagina_agencia/teste3.php [L,QSA]
And that's not functional, because I am going to create 10k files inside the folder "directory"...
- If the user directly requests [
www.avantitecnologiati.com.br/agencias/pagina_agencia/teste2
], it needs to redirect to the page [www.avantitecnologiati.com.br/teste2
] and wouldn't display the real location...
Thanks for your time to read my question ;)
FULL HTACCESS CODE
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ avantitecnologiati.com.br$1 [R=301,L]
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.avantitecnologiati.com.br
RewriteRule ^teste2 agencias/pagina_agencia/teste2.php [L,QSA]
RewriteRule ^teste3 agencias/pagina_agencia/teste3.php [L,QSA]
#Hide and Redirect Extension
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]+\s.+\.php\sHTTP/.+
RewriteRule ^(.+)\.php$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
#Custom Error Page
ErrorDocument 404 http://www.avantitecnologiati.com.br/
I am getting a 302 error when try to use the arkascha rule's, when I request the url: http://www.avantitecnologiati.com.br/ it doesn't find the file ;(