How do I rewrite this rule to redirect everything back to the index or server_root?
If there is a request开发者_JS百科 for say, www.site.com/articles/some-article.php, the somearticle.php should be re-routed back to the index page. I also don't want to have the url showing the "index" portion of the URL. site.com/index is where everything should be at.
RewriteRule ^(.*)$ index.php?dk=$1 [L,QSA]
OK, I see now what is happening and I think it may help someone to help me better. With my rule, exactly as it is above in my example, I can get the following back into my index.php file with no problems.
http://site.com/index/somethin/else/here/test.php
Here is what I need: I need to remove the index portion of the url. This url should be rewritten as: http://site.com/somethin/else/here/test.php
I hope this helps.
RewriteRule ^.*/(.*)$ /?dk=$1 [L,QSA]
...if you only want to pass it the file name, or...
RewriteRule ^(.*)$ /?dk=$1 [L,QSA]
...if you want the full path
The rewrite would pass the url to be www.site.com/index.php?dk=articles/some-article.php
, is that what you are after?
RewriteRule ^/articles/(.*)$ index.php?dk=$1 [L,QSA]
This should give you www.site.com/index.php?dk=some-article.php
RewriteRule ^/articles/(.*).php$ index.php?dk=$1 [L,QSA]
gives you www.site.com/index.php?dk=some-article
Or do you want www.site.com/?dk=some-article
?
精彩评论