Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7003659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:05:52+00:00 2026-05-27T21:05:52+00:00

I need help about URL rewriting for image gallery for site. This is problem,

  • 0

I need help about URL rewriting for image gallery for site.

This is problem, I needed to change hosting so I moved site to another server and there was problem because when it was transfered to that new server site worked without url rewriting, even if .htaccess file was present.
After few days problem is solved and my links look nice again. But search engines crawled my site in time when URL rewriting in .htaccess was not working somehow, so same pages are indexed in both ways, with nice URL and with out URL rewriting.
Like I said links are ok now, but there are a lot of results in data base of search engines which are still opening like that.

Normal fine links produced by CMS image gallery look like this:

http://www.mysite.net/Category/Subcategory/Item-name.html

But, in search engine data base there are still a lot of results witout URL rewriting, with links like this:

http://www.mysite.net/show.php?cat=Category&sub_cat=Subcategory&img=Item-name

Example:

If anyone try to open page it will be opened in both ways, practically you can see the same page opening this:

http://www.mysite.net/Category/Subcategory/Item-name.html

and this

http://www.mysite.net/show.php?cat=Category&sub_cat=Subcategory&img=Item-name

Can you help me with some SEO friendly URL redirect rules

This is part of my .htaccess file related to image gallery.


Options +FollowSymLinks

RewriteEngine On
RewriteBase /

######## Begin - URL rewriting for image gallery ########

## For showig category of item
RewriteRule ^(.*)/$ showcat.php?cat=$1 [L]

## For showig subcategory of item
RewriteRule ^(.*)/(.*)/$ showcat.php?cat=$1&subcat=$2 [L]

## For showig item
RewriteRule ^(.*)/(.*)/(.*).html$ show.php?cat=$1&sub_cat=$2&img=$3 [L]

## For latest items
RewriteRule ^latest-page-(.*)/$ latest.php?page=$1 [L]

## For top rated items
RewriteRule ^top/page/(.*)/$ top.php?page=$1 [L]

## For show most rated - most clicked - most downloaded and most searched items
RewriteRule ^most-rated.html$ showmost.php?type=1 [L]
RewriteRule ^most-clicked.html$ showmost.php?type=2 [L]
RewriteRule ^most-downloaded.html$ showmost.php?type=3 [L]
RewriteRule ^most-Searched.html$ showmost.php?type=4 [L]

######## Begin - URL rewriting for image gallery ########


Still, I can not get just this kind of links:

http://www.mysite.net/Category/Subcategory/Item-name.html

I tried your solution, like this:

Options +FollowSymLinks

RewriteEngine On
RewriteBase /

######## Begin - URL rewriting for image gallery ########

## For showig category of item
RewriteRule ^(.*)/$ showcat.php?cat=$1 [L]

## For showig subcategory of item
RewriteRule ^(.*)/(.*)/$ showcat.php?cat=$1&subcat=$2 [L]

## For showig item
RewriteRule ^(.*)/(.*)/(.*).html$ show.php?cat=$1&sub_cat=$2&img=$3 [L]

## this section should be inserted just after the showing item rule above
#if the query string has cat, sub_cat and Img
RewriteCond %{QUERY_STRING} ^cat=(.+)&sub_cat=(.+)&img=(.+)$ [NC]
#and it is for resource show.php, then 301 redirect to Keyword rich URL
RewriteRule ^show\.php$ http://www.mysite.net/%1/%2/%3.html [NC,L,R=301]

## For latest items
RewriteRule ^latest-page-(.*)/$ latest.php?page=$1 [L]

## For top rated items
RewriteRule ^top/page/(.*)/$ top.php?page=$1 [L]

## For show most rated - most clicked - most downloaded and most searched items
RewriteRule ^most-rated.html$ showmost.php?type=1 [L]
RewriteRule ^most-clicked.html$ showmost.php?type=2 [L]
RewriteRule ^most-downloaded.html$ showmost.php?type=3 [L]
RewriteRule ^most-Searched.html$ showmost.php?type=4 [L]

######## End - URL rewriting for image gallery ########

And now, I can access the same page with this normal URL:

http://www.mysite.net/Category/Subcategory/Item-name.html

And, I guess because of your new URL redirection rule now URL like this:

http://www.mysite.net/show.php?cat=Category&sub_cat=Subcategory&img=Item-name

is redirected to this:

http://www.mysite.net/Item-name.html?cat=Category&sub_cat=Subcategory&img=Item-name

But, you sure know that I wish just this URL:

http://www.mysite.net/Category/Subcategory/Item-name.html
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:05:53+00:00Added an answer on May 27, 2026 at 9:05 pm

    If search engines indexed your site with the old URLs and you have since changed them to keyword rich URLs, then the correct way to let them know to use the new ones is to 301 redirect requests for the old URLs to the new ones.

    Edit your current .htaccess file and place the section to redirect the old URLs to the new ones just after the showing item rule, as below.

    ## For showig item
    RewriteRule ^(.*)/(.*)/(.*).html$ show.php?cat=$1&sub_cat=$2&img=$3&rewrite=true [L]
    
    ## this section should be inserted just after the showing item rule above
    #if the query string has cat, sub_cat and Img
    RewriteCond %{QUERY_STRING} ^cat=(.+)&sub_cat=(.+)&img=(.+)$ [NC]
    #and it is for resource show.php, then 301 redirect to Keyword rich URL
    RewriteRule ^show\.php$ http://www.mysite.net/%1/%2/%3.html? [NC,L,R=301]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help with url-rewriting in .htaccess. So the issue is about different protocols:
Not exactly about programming, but I need help with this. I'm running a development
I will apprecaite your help in this topic. I need to build a site
I need some help about mod_rewrite, this is my wordpress address: http://localhost/my_v2010/restaurants?m=display_Add base_url: http://localhost/my_v2010/
Need some help about with Memcache. I have created a class and want to
I need some help about WCF and authorization. Currently I have a client which
I need some help about RegExp in AS3. I have a simple pattern :
Well, I know absolutely nothing about the subject, so I really need help. I
need ask you about some help. I have web app running in Net 2.0.
Need help writing a script downloads data from google insight using c# this is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.