
![]() |
nutballs
i have tried a bunch of things that should work, but dont.
how do i redirect requests that come in without a named document such as: http://www.somedomain.com/ that trailing slash. I want anything that comes into the root of the domain to get redirected to a specific page. i tried RewriteRule ^/$ /targetpage. php[L,R]but it no worky. perkiset
It's funny you post this... I had some
Apachestuff I was after yesterday and had trouble with mod_rewrite & .htaccess all day as well - I put the exact same code into the httpd.conf file and it worked perfectly. So I am thinking there is something I don't know about the way that mod_rewrite executes in .htaccess that is different from the way it behaves when in the .conf file...I'll be looking at that today and will post as I know more. Your instruction looks fine, you're on the right track... more as I grind it out. /p Bompa
quote author=nutballs link=topic=829.msg5722#msg5722 date=1205555942 i have tried a bunch of things that should work, but dont. how do i redirect requests that come in without a named document such as: http://www.somedomain.com/ that trailing slash. I want anything that comes into the root of the domain to get redirected to a specific page. i tried RewriteRule ^/$ /targetpage. php[L,R]but it no worky. Is that all you tried? What happened with that code? I use this on several domains: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !images RewriteRule (.*) homepage.cgi <> The Cond is so gif in my images folder do not get rewritten. If I used the R flag, it would wind up in a loop. On some file systems, nothing works without the correct RewriteBase. Also, the / does not need to be escaped cuz the regexis not using /'s as delimiters.perkiset
Two interesting points...
* I don't use the R flag, so I don't know its behavior * I notice no forward slash in the front the conversion... I wonder if by adding a forward slash in the .htaccess file if that causes a loop as well... nutballs
bomps, thanks for the feedback, it sparked the solution for me. Yea i tried a bunch of things, i just meant to post 1 to show the "area" I had been looking in.
This worked: RewriteRule ^$ /somepage. php[L,NC]yeay team. |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads