Note that there are some explanatory texts on larger screens.

plurals
  1. PO.htaccess URL rewriting - pages are opening with URL and without URL rewriting even if URL rewriting rules are present in .htaccess file
    text
    copied!<p>I need help about URL rewriting for image gallery for site.</p> <p>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.</p> <p>Normal fine links produced by CMS image gallery look like this:</p> <pre><code>http://www.mysite.net/Category/Subcategory/Item-name.html </code></pre> <p>But, in search engine data base there are still a lot of results witout URL rewriting, with links like this:</p> <pre><code>http://www.mysite.net/show.php?cat=Category&amp;sub_cat=Subcategory&amp;img=Item-name </code></pre> <p>Example:</p> <p>If anyone try to open page it will be opened in both ways, practically you can see the same page opening this:</p> <pre><code>http://www.mysite.net/Category/Subcategory/Item-name.html </code></pre> <p>and this</p> <pre><code>http://www.mysite.net/show.php?cat=Category&amp;sub_cat=Subcategory&amp;img=Item-name </code></pre> <p>Can you help me with some SEO friendly URL redirect rules</p> <p>This is part of my .htaccess file related to image gallery.</p> <hr> <pre><code>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&amp;subcat=$2 [L] ## For showig item RewriteRule ^(.*)/(.*)/(.*).html$ show.php?cat=$1&amp;sub_cat=$2&amp;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 ######## </code></pre> <hr> <hr> <p><strong>Still, I can not get just this kind of links:</strong></p> <pre><code>http://www.mysite.net/Category/Subcategory/Item-name.html </code></pre> <p><strong>I tried your solution, like this:</strong></p> <pre><code>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&amp;subcat=$2 [L] ## For showig item RewriteRule ^(.*)/(.*)/(.*).html$ show.php?cat=$1&amp;sub_cat=$2&amp;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=(.+)&amp;sub_cat=(.+)&amp;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 ######## </code></pre> <p>And now, I can access the same page with this normal URL:</p> <pre><code>http://www.mysite.net/Category/Subcategory/Item-name.html </code></pre> <p>And, I guess because of your new URL redirection rule now URL like this:</p> <pre><code>http://www.mysite.net/show.php?cat=Category&amp;sub_cat=Subcategory&amp;img=Item-name </code></pre> <p>is redirected to this:</p> <pre><code>http://www.mysite.net/Item-name.html?cat=Category&amp;sub_cat=Subcategory&amp;img=Item-name </code></pre> <p>But, you sure know that I wish just this URL:</p> <pre><code>http://www.mysite.net/Category/Subcategory/Item-name.html </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload