How to changes the URL from this 1. http://www.domainname/newfolder/[pagename]/randomvalue1/randomvalue2 to this 2. http://www.domainname/newfolder/randomvalue1/randomvalue2 As I want to remove the pagename from URL with .htaccess, max of pages already index in Google , so when someone come to url 1 then the system need to redirect to URL 2. I have tried so many times but failed. Thanks in Advance
Not tested of course but it should redirect to "newfolder/randomvalue1/randomvalue2" Which are variables $2 & $3 Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^newfolder/([^/]+)/([^/]+)/([^/]+)\?$ newfolder/$1/$2/$3 [L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /newfolder/([^&]+)/([^&]+)/([^&]+)\ HTTP/ RewriteRule ^index\.php$ /newfolder/%2/%3? [R=301,L] PHP:
Hi webmaster365, The first url seems to have been created using rewrite rule itself, is it the case? If so, making little modification in the same rule will give you desired result.
Can you please tell me what is the change. As my code like below. Options +FollowSymLinks All Options -MultiViews All RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.com [NC] RewriteRule ^(.*)$ http://www.domain.com/movies/$1 [L,R=301] RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/.*$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^overview/(.*)/(.*)$ overview.php?mv=$1&id=$2 [L] So, the above URL i want to change. i need to remove the overview part as this is page name. Thanks
Is overview an actual directory? If not, changing RewriteRule ^overview/(.*)/(.*)$ overview.php?mv=$1&id=$2 [L] Code (markup): INTO RewriteRule ^(.*)/(.*)$ overview.php?mv=$1&id=$2 [L] Code (markup): should help. Can you share original URLs with us? That would give us much better idea on what has to be done.
The URL is : - www.fridayrelease.com/movies/overview/patang/9945 the overview is page name not folder name Thanks for your valuable time.