I have url's like this ; http://localhost/project/showpage.php?page=avas Code (markup): But I want like this http://localhost/project/avas Code (markup): when i use webmaster-toolkit's rewrite tool, it generates, this codes http://localhost/project/showpage/page/avas/ Code (markup): Options +FollowSymLinks RewriteEngine on RewriteRule showpage/(.*)/(.*)/$ /project/showpage.php?$1=$2 Code (markup): But I dont want "showpage" and "page" element on url , just clean http://localhost/project/avas Code (markup): is this possible and if possible how can i use custom code for this ?
i solved first part Options FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} !\.{2,5} [NC] RewriteRule ^([^/]+)/$ /project/showpage.php?page=$1& [L,NC] but if typed. http://localhost/project/avas - gives 404 error else http://localhost/project/avas/ - it will work so how can i add automatic trailing slash's end of the url ?
Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^project/([^.]+)/$ project/showpage.php?page=$1 [L] RewriteRule ^project/([^.]+)$ project/showpage.php?page=$1 [L] both with and with out da /.
thanks for reply, but still wont work, your code gives "Server error". How can i add a line for fixing trailing slash problem, for this code ? Options FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} !\.{2,5} [NC] RewriteRule ^([^/]+)/$ showpage.php?page=$1& [L,NC]
Options FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_URI} !\.{2,5} [NC] RewriteRule ^([^/]+)/$ showpage.php?page=$1& [L,NC] RewriteRule ^([^/]+)$ showpage.php?page=$1& [L,NC]
Just add a question mark to have an optional trailing slash, that way, you only need 1 rule RewriteRule ^([^/]+)/?$ showpage.php?page=$1& [L,NC] Code (markup):