.Darkman Posted October 16, 2007 Share Posted October 16, 2007 Hello Everybody, I'm using MediaWiki and using .htaccess to make URLs better. Using this code : RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA] This redirects http://mysite.com/Page to http://mysite.com/index.php?title=Page I want to achieve this for subpages also. (i.e) I want to redirect http://mysite.com/Page/Sub to http://mysite.com/index.php?title=Page/Sub How do i do this ? I tried few codes. But, they didn't work. Please help me. Thanks, Quote Link to comment Share on other sites More sharing options...
.Darkman Posted October 17, 2007 Author Share Posted October 17, 2007 Anyone ?? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 18, 2007 Share Posted October 18, 2007 Try: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?title=$1 [L,QSA] Quote Link to comment Share on other sites More sharing options...
.Darkman Posted October 19, 2007 Author Share Posted October 19, 2007 I added just the third line and it worked. What are the other two lines for ? I mean, what are these for ? RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 19, 2007 Share Posted October 19, 2007 They are conditions, they basically check if the requested filename is not an existing file/directory. If it is then the rewrite rules that follow will be ignored. if you didn't add those lines in then Apache will always rewrite every url to index.php?title=request/file/path/here You don't have to have those lines if you don't want them. But I have found they can be useful. 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.