Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The below is the .htaccess code which is causing the rewrite in URL,

RewriteRule ^24-(.+)~(.+)\.html$ gallery_catagory.php?gallnm=$1&GalleryID=$2&%{QUERY_STRING} [nc]

but still I can see the query string appended after .html? for each page.

How should I hide/rewrite URL to make it search engine friendly?

share|improve this question

2 Answers 2

mod_rewrite is the wrong place to make URL's "friendly". This has to happen inside the web application, because it creates the links inside the pages in the first place.

You need rewrite rules to translate this "friendly" URLs back into something the web app can understand. What kind of rules you need depends on the app you use (which you don't name) and you should find this in the documentation.

share|improve this answer

This rewrite rule alone will enable both "friendly" urls and "ugly" urls: same content is accessible via two urls.

.htaccess rewrite rules are to route requests to the .php script responsible for the content requested.

Urls generated into html by .php script are presented to a user and it is up to you as a php-developer to generate "friendly" urls.

You may even force the usage of friendly urls by adding either adding Redirect rules to .htaccess or header("Location: ....") to your php scripts.

Note that even after you have changed your php scripts to generate only friendly urls, you may still see in web-server logs the requests of old ugly urls - this is because your site has been crawled by search engines or some links to your pages were copied to other sites (blogs, forums) - it is ok.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.