This is my .htaaccess code.
RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)/$ movie.php?name=$1
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example\\.in$
Rew
RewriteEngine on
RewriteRule ^movie/([0-9a-zA-Z]+)$ movie.php?name=$1 [L]
Add above code in .htaccess file
If you're want to have clean URLs, then you have to use clean URLs in your html code, e.g. use
<a href="/movie/titanic">Titanic</a>
Your rewrite rules will take that doesn't-really-exist-on-the-server address (you don't really have a /movie
directory that contains a titanic
file, after all), and translates it in to the actual
/movie.php?name=titanic
The user would never see this url, however, because the rewrite would take place purely within Apache. As long as the HTML you send to the user contains only "clean" urls, they'll never see the query strings.
Replace your code with this:
ErrorDocument 404 /404.php
AddDefaultCharset UTF-8
Header unset ETag
FileETag None
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+movie\.php\?name=([^\s&]+) [NC]
RewriteRule ^ movie/%1? [R=301,L]
RewriteRule ^movie/([^/]+)/?$ movie.php?name=$1 [L,QSA]