Domain.com/.htaccess Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^search/(.*)/$ search/search.php?q=$1 domain.com/search/search.php?q=KEYWORD to domain.com/search/KEYWORD/
Dear Mr. Nitendo Could you please take a look on my .htaccess file, i think that it's need to orginize php_flag session.use_trans_sid off RewriteEngine On RewriteRule ^index\.html$ index.php RewriteRule ^top\.html$ top.php RewriteRule ^about\.html$ about.php RewriteRule ^adv\.html$ adv.php RewriteRule ^new_articles\.html$ new_articles.php RewriteRule ^lightbox\.html$ lightbox.php?%{QUERY_STRING} RewriteRule ^lightbox\.([0-9]+)\.html$ lightbox.php?page=$1&%{QUERY_STRING} RewriteRule ^search\.html$ search.php?%{QUERY_STRING} RewriteRule ^search\.([0-9]+)\.html$ search.php?page=$1&%{QUERY_STRING} RewriteRule ^search_new.html$ search.php?search_new_images=1 RewriteRule ^cat\.html$ categories.php?%{QUERY_STRING} RewriteRule ^cat([0-9]+)\.([0-9]+)\.html$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING} RewriteRule ^cat([0-9]+)\.html$ categories.php?cat_id=$1&%{QUERY_STRING} RewriteRule ^img([0-9]+)\.html$ details.php?image_id=$1&%{QUERY_STRING} RewriteRule ^img([0-9]+)\.([a-zA-Z0-9]+)\.html$ details.php?image_id=$1&mode=$2&%{QUERY_STRING} RewriteRule ^postcard([a-zA-Z0-9]+)\.html$ postcards.php?postcard_id=$1&%{QUERY_STRING} RewriteRule ^postcard\.img([0-9]+)\.html$ postcards.php?image_id=$1&%{QUERY_STRING} RewriteRule ^articles_category([0-9]+)\.html$ articles_category.php?topic=$1&%{QUERY_STRING} RewriteRule ^article([a-zA-Z0-9]+)\.html$ articles.php?id=$1&%{QUERY_STRING} RedirectMatch permanent ^/$ http://www.racing4e.com/index.html Code (markup): I would like also to use L and R and 301 but when I use it as your post it gave me internal error. Thank you and best regards,
Dear Sir Thank you for your question %{QUERY_STRING} is what Chris in 4images.net advice us to use for url-friendly You could review his post to tike more understand of his logic http://www.4homepages.de/forum/index.php?topic=6729.0
Make a post over in that thread. Looks like some crazy server if there suggesting %{QUERY_STRING} be there.
excellent thread! Maybe I missed it, but here goes ... I have 2 .xml files, one is generated with PHP (something.xml), while the other is static (sitemap.xml). How do you disable .htaccess from running php on the 'sitemap.xml' static file? here's what I got: Options +FollowSymLinks rewriteEngine on AddType application/x-httpd-php .xml RewriteRule ^something(.*)\.htm$ something.php?ID=$1 [L] ..... Code (markup):
Dear Sir, Thank you for your reply, I don’t know what %{QUERY_STRING} do exactly, but by testing it I can say that it's slow down the redirect very much when I saw your thread and I read it, I got the understand that you are master in this issue and that is the reason that make me register in this forum to ask you for your advice and suggestion to make the code in a better way, Please be sure that I didn’t come here to give the impression that what I admonition is better of your thread here. Please fix the code for my. Best regards,
php_flag session.use_trans_sid off Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^index\.html$ index.php RewriteRule ^top\.html$ top.php RewriteRule ^about\.html$ about.php RewriteRule ^adv\.html$ adv.php RewriteRule ^new_articles\.html$ new_articles.php RewriteRule ^lightbox\.html$ lightbox.php RewriteRule ^lightbox\.([0-9]+)\.html$ lightbox.php?page=$1 RewriteRule ^search\.html$ search.php RewriteRule ^search\.([0-9]+)\.html$ search.php?page=$1 RewriteRule ^search_new.html$ search.php?search_new_images=1 RewriteRule ^cat\.html$ categories.php RewriteRule ^cat([0-9]+)\.([0-9]+)\.html$ categories.php?cat_id=$1&page=$2 RewriteRule ^cat([0-9]+)\.html$ categories.php?cat_id=$1 RewriteRule ^img([0-9]+)\.html$ details.php?image_id=$1 RewriteRule ^img([0-9]+)\.([a-zA-Z0-9]+)\.html$ details.php?image_id=$1&mode=$2 RewriteRule ^postcard([a-zA-Z0-9]+)\.html$ postcards.php?postcard_id=$1 RewriteRule ^postcard\.img([0-9]+)\.html$ postcards.php?image_id=$1 RewriteRule ^articles_category([0-9]+)\.html$ articles_category.php?topic=$1 RewriteRule ^article([a-zA-Z0-9]+)\.html$ articles.php?id=$1 RedirectMatch permanent ^/$ http://www.racing4e.com/index.html A lot of those only work if they only have numbers. ([^.]+) covers a lot more.
Dear Nintendo, Thank you very much for fixing my code, I just add it to my web site and I can see that there is a different in speed I would like to use 301 redirect in all my links, so is it done by just adding [L,R=301] to the end of every line of RewriteRule and RedirectMatch ? Thank you again and best regards,
Examples... RewriteRule ^shop/([^.]+)$ http://www.domain.com/$1/ [R=301,L] or for just one URL... RewriteRule ^whatever/$ http://www.domain.com/ [R=301,L]
Master Nintendo! Any thoughts on how to disable one file within .htaccess? If I have this in my .htaccess file ... AddType application/x-httpd-php .xml Code (markup): but want 1 file, like 'sitemap.xml', not to be parsed by php? All others are to be parsed (which works great!) Thank you x1000!
Something like... <FilesMatch "^sitemap\.xml$"> AddType application/x-httpd-php .xml </FilesMatch> might do it, though I couldn't get this to do it last time I tried.
Hi, -I would like to share some of my thoughts on this thread. -I was scared to read about mod_rewrite each time i start reading a tutorial i was scared to create mess with my site. 5 Days back i read this thread and it looks so simple to me. In just 1 hour i converted by site dynamic URLs to Static html files. What a simple way to explain things. I started my site 16months back i would like to standout in the industry as in my country there is no such title call webmaster i hardly seen people from my country who do optimization and SEO work for a website some of the good sites i have seen are runned by people from my country but they live outside like USA nd UK so things are bit difficult for a person like me as server cost is high and it is impossible to have a sponsor. -This thread helps me alot, i learned how to play with mod_rewrite and i get the same results i was expecting. My site 771 pages was indexed by google and after implementing mod_write today google indexed over 9000 pages i would like to thanks Nintendo for starting such a thread that help me get better position. After doing all the optimization and with last google update i was ranking 80 for the most important keyword but today i am at 9th place visible on first page. Trafic is increasing from 1500 daily visitors to arround 4000 visitors. -I hope i will learn day by day from this forums many experience people are here which i considered my teacher that teach a person who have no resources in the country as no such technical education exits for website optimization and SEO work exits. -This thread help to achive a millestone as my site starts ranking better in google and increased visitors which help me earn money from my site aswell. I would like to thanks Nintendo once again for such a thread that helps me alot. -Also i would like to thanks all the members who contributed in thread and by reading their comments and questions i learned more. Regards.
Editing the script to take it out in the URL, or search and replace it in to a _ or - is the only way I know of of geting rid of it.