commentator Posted July 17, 2007 Share Posted July 17, 2007 Hi, I'm trying to rewrite everything on my domain to a php file RewriteRule ^([A-Za-z_0-9/]+)$ file.php/$1 this is working for directories now: so http://my.dom.ain/dir1/dir2/ is redirected to file.php/dir1/dir2/ I want to use this also for files. like: http://my.dom.ain/dir1/dir2/file1.ext http://my.dom.ain/dir1/file9.ext When adding a dot like: RewriteRule ^([A-Za-z_0-9/.]+)$ file.php/$1 or RewriteRule ^([A-Za-z_0-9/\.]+)$ file.php/$1 it doesn't work. Anyone here knowing how to fix this? Quote Link to comment Share on other sites More sharing options...
hackerkts Posted July 19, 2007 Share Posted July 19, 2007 How about this? Not sure what you want to do, and I didn't test it. RewriteRule ^([A-Za-z_0-9]+)/(\.)$ file.php/$1 Quote Link to comment Share on other sites More sharing options...
commentator Posted July 20, 2007 Author Share Posted July 20, 2007 Not sure what you want to do, and I didn't test it. ... this is working for directories now: so http://my.dom.ain/dir1/dir2/ is redirected to file.php/dir1/dir2/ I want to use this also for files. like: http://my.dom.ain/dir1/dir2/file1.ext http://my.dom.ain/dir1/file9.ext ... Quote Link to comment Share on other sites More sharing options...
hackerkts Posted July 21, 2007 Share Posted July 21, 2007 Dude, why are you copying the same question you're asking? I did read your first post, but I still don't understand, you should be giving more details example of what you're asking. Simply, I know how your file.php works, but you can try this, RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)?/?([a-zA-Z0-9-_]+)(\.[a-zA-Z0-9]+)$ file.php?dir=$1&dir2=$2&$file=$3&ext=$4 Quote Link to comment Share on other sites More sharing options...
commentator Posted July 22, 2007 Author Share Posted July 22, 2007 well it's very simple what I want, just to have everything in this $1 behind the file RewriteRule ^([A-Za-z_0-9/]+)$ file.php/$1 The script checks the dirs and expects just everything behind the / behind file.php/ For dirs it is already working: my.domain/dir1/dir2/ my.domain/dir1/dir2/dir3/ my.domain/dir1/dir2/dir4/dir5/dir6/ al these dirs are now in the $1 but I want to use this also for files my.domain/dir1/dir2/file1.ext my.domain/dir1/dir2/dir3/file98098.ext my.domain/dir1/dir2/dir4/dir5/dir6/file5456416546.ext I want the dirs above like: file.php/my.domain/dir1/dir2/file1.ext file.php/my.domain/dir1/dir2/dir3/file98098.ext file.php/dir1/dir2/dir4/dir5/dir6/file5456416546.ext all I need to know is how to add the . in this rule like the / that works already RewriteRule ^([A-Za-z_0-9/]+)$ file.php/$1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.