Forum Moderators: phranque
I have the following code in my httpd.conf file:
<VirtualHost *>
ServerName websitename
DocumentRoot D:/wwww/websitename
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule !\.(js¦ico¦gif¦jpg¦png¦css)$ /index.php
</VirtualHost>
This works as it should work. Everything except the admin folder is redirected to index.php (with the exception of the js,ico,gif,jpg,png and css file extensions).
What I want is that everything call in the admin folder get redirected to the index.php in the admin folder.
Example:
www.mywebsite.com/admin/test should be redirected to www.mywebsite.com/admin/index.php
I have tried about one thousand possibilities but notting seems to work.
Could somebody give me a hint or maybe just the solutions. (If you give me the sollution, could you please tell me why this is the solution. I don't want to bother you with some kind of question again).
Many thanks,
Randy Cillekens
RewriteCond %{REQUEST_URI} [b]^/a[/b]dmin
RewriteRule !\.(js¦ico¦gif¦jpg¦png¦css)$ [b]/admin/[/b]index.php [L]
I allready have tried that. I had the following:
<VirtualHost *>
ServerName websitename
DocumentRoot D:/websites/websitename
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule !\.(js¦ico¦gif¦jpg¦png¦css)$ /index.php [L]
RewriteCond %{REQUEST_URI} ^/admin
RewriteRule !\.(js¦ico¦gif¦jpg¦png¦css)$ /admin/index.php [L]
</VirtualHost>
But when I now go to [websitename...] I get a message that the page doesn't redirect in a right way. Firefefox had noticed that this was a redirect with a never ending loop.
(sorry for my bad translation, the error is in dutch).
I hope you can help me again.
Kind regards,
Randy
I allready figured it out. I had a loop in my code. The index.php called the header function. [header("Location: login");] This causes that he was redirected to [websitename...] And firefox detected a loop I guess. And this is also the reason that I tought it didn't work.
Thank for your help and time!
Randy