I have this simple redirection on my website and it does not rewrite my url automatically, I have to type manual other URL to access it, what could be the problem, do I need
check your apache config (httpd.conf) see whether it allowing to overriding the htaccess
http://httpd.apache.org/docs/2.0/howto/htaccess.html
If you are doing it in .htaccess
you should also specify RewriteBase /
.
Try
RewriteEngine On
RewriteBase /
RewriteRule ^new-page-([^/]*)\.php$ mypage.php?name=$1 [L]
This rewrites new-page-something.php
tomypage.php?name=something
internally.
ADDED:
Perhaps you want this:
RewriteEngine On
RewriteBase /
RewriteRule ^new-page-([^/]*)\.php$ mypage.php?name=$1 [L]
RewriteCond %{THE_REQUEST} ^(GET|POST|HEAD|TRACE)\ /mypage.php
RewriteCond %{QUERY_STRING} name=([^\&]*)
RewriteRule ^mypage.php$ new-page-%1.php? [R,L]
The first added RewriteCond checks whether the real request is requesting for /mypage.php
to prevent a redirect loop.
The second added RewriteCond is used to match the query string for use in RewriteRule.
I have the following link
www.preparationweb.com/Aptitude/Discussion/index.php?qid=26
I like it to appear it as
www.preparationweb.com/Aptitude/Discussion/26
Can you please provide me the code to be placed in .htaccess file according to the provided link. I have a godaddy hosting.