O
O
Ockonal2013-11-15 23:29:36
Apache HTTP Server
Ockonal, 2013-11-15 23:29:36

Rewrite rules and apache?

Hello. There is a folder in /var/www to which some domain is directed: /var/www/anotherdomain
Address example: anotherdomain.com/index.php?tpl=NAME I
wrote this rule in .htaccess:

DirectoryIndex index.php
RewriteEngine On
RewriteBase /anotherdomain

Options -indexes

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^([^/]+)/?$ /anotherdomain/index.php?tpl=$1 [L,QSA]

The thing is that there is a similar folder with a different name, there is exactly the same .htaccess and everything works. Here I try to open anotherdomain.com/index.php?tpl=NAME instead of anotherdomain.com/index.php?tpl=NAME and the server tries to give the NAME.php file.
What's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fstpk, 2013-11-16
@Ockonal

If .htaccess is in the root (www-root of the virtual host) /var/www/anotherdomain, then

RewriteEngine On
RewriteBase /

and then everything else.
Or wrong options for Allow Override http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question