hi, i need your help for my blogging system. domain.com/blogs.php?blog_name=USER-NAME USER-NAME part can be change and user can use " a-z OR 0-9 OR '-' " with using htaccess i want to do, if a visitor visit URL domain.com/USER-NAME like that opening domain.com/blogs.php?blog_name=USER-NAME adress how can ı do with using mod_write in htaccess?
Options +FollowSymLinks RewriteEngine on RewriteRule (.*)/$ blogs.php?blog_name=$1 put the above code in your .htaccess and then it should be accesable at domain.com/USER-NAME
Not Found says. can u check? http://www.woips.com/blogs.php?blog_name=ykntr http://www.woips.com/ykntr
See http://www.woips.com/ykntr/ If u want it accessable at http://www.woips.com/ykntr (with out the bracket also) then change it to Options +FollowSymLinks RewriteEngine on RewriteRule (.*)/$ blogs.php?blog_name=$1 RewriteRule (.*)$ blogs.php?blog_name=$1
One thing I would point out is that just with the above code you are going to route EVERYTHING through your blogs.php script (including images, css files etc etc) Really you should have a prefix to identify it's meant to be a users profile such as /profile/username-here
That's incorrect Bohra You need to change it to something like RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/?(\w-]+)/?$ blogs.php?blog_name=$1 [L] Code (markup):
Cool. Try it without the /? at the beginning of the rewrite rule and see if it still works. If it does, remove it
ohk i was in the perception thats its fine but i guess it isnt after all coz files like http://www.woips.com/templates/tictac/img/top_h1_blue.gif still work even if we have the .htaccess
Unless you tell the rewrite engine to check if a file exists it will just try and rewrite it anyway The psuedo code of the rewrite above is -> Turn rewrite Engine on -> If File doesn't exist -> and folder doesn't exist -> rewrite the url if it matches the pattern to blog.php