Mod Rewrite need help
Moderator: General Moderators
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
Mod Rewrite need help
I would like to redirect all links that has "backend" word in it to the backend.php
My links may look:
http://localhost/backend/group
http://localhost/backend/group/list
Pls i really need help with this issue
My links may look:
http://localhost/backend/group
http://localhost/backend/group/list
Pls i really need help with this issue
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Code: Select all
RewriteRule ^(backend).*$ /backend.php [QSA,L]-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
Is not working, i got an 500 error
, i don't know why is keep looping.
The script should not perform redirect if i'm requiring an image, so what is wrong here, especially with the redirect rule?
The script should not perform redirect if i'm requiring an image, so what is wrong here, especially with the redirect rule?
Code: Select all
RewriteCond %{REQUEST_URI} !\.(js|ico|gif|jpg|png|css)$
RewriteRule ^(backend).*$ /backend.php [QSA,L]- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
This is my htaccess
Looking in error logs:
Code: Select all
RewriteEngine on
RewriteCond %{REQUEST_URI} !\.(js|ico|gif|jpg|png|css)$
RewriteRule ^(backend).*$ /backend.php [QSA,L]
php_value include_path ".;d:/proiecte/proiect/library.;d:/proiecte/proiect"Code: Select all
[Mon Aug 14 09:18:02 2006] [error] [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Code: Select all
RewriteEngine on
# Im not sure if this one is right or not
RewriteCond %{REQUEST_URI} !\.(js|ico|gif|jpg|png|css)$
# If there is an exact match, skip the next 1 lines
RewriteRule ^.*$ - [S=1]
# If the URI is backend* redirect to backend.php
RewriteRule ^(backend).*$ /backend.php [QSA,L]
# Not sure what this does
php_value include_path ".;d:/proiecte/proiect/library.;d:/proiecte/proiect"-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
The problem is that he is trying to get
And not the backend.php. I also removed conditions but same problem. Is because QSA is adding backend instead of what i need?
Code: Select all
D:/proiecte/proiect/document_root/backend- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
Just a little help if you can, my problem is that if i have that backend i would like to redirect to the backend.php otherwise i would like top redirect to the index.php, which in my case is frontend.
Can you suggest me something? I will make a study on it after.
I succed to create something:
But i don't know why the script is not ending if a backend has been found. It is continuing and is making a redirect to index 
Can you suggest me something? I will make a study on it after.
I succed to create something:
Code: Select all
RewriteCond %{REQUEST_URI} !\.(js|ico|gif|jpg|png|css)$
RewriteRule ((.*)\/)backend(\/.*)$ backend.php [L]
RewriteRule !((.*)\/)backend(\/.*)$ index.php [L]- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
I'm thinking at something like this:
This id working:
But when i'm adding the index line he is not stoping at backend (if URL has backend inside, it is continuing and redirects me to index) 
Code: Select all
RewriteEngine on
php_value include_path ".;d:/proiecte/proiect/library.;d:/proiecte/proiect"
RewriteCond %{REQUEST_URI} !\.(js|ico|gif|jpg|png|css)$
RewriteRule ^.*$ index.php [L]
RewriteRule ^backend\/.*$ backend.php [L]Code: Select all
RewriteEngine on
php_value include_path ".;d:/proiecte/proiect/library.;d:/proiecte/proiect"
RewriteCond %{REQUEST_URI} !\.(js|ico|gif|jpg|png|css)$
RewriteRule ^backend\/.*$ backend.php [L]- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
Solved, solution is:
Code: Select all
RewriteEngine on
php_value include_path ".;d:/proiecte/proiect/library.;d:/proiecte/proiect"
RewriteCond %{REQUEST_URI} !\.(js|ico|gif|jpg|png|css)$
RewriteRule ^backend\/.*$ backend.php [L,S=1]
RewriteRule ^((?!backend).)*$ index.php [L]- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA