Redirecttion without id		
	
	
	
		
	
	
	
	
	
		
		
				
		- 
			kalixo
		
- 
													Topic Author
											
- 
				
	Offline
			
- 
				Senior Member			
- 
				  
		Less
		More
		
			
									- 
						Posts: 45					
- 
						Thank you received: 0					
- 
											
- 
											
 
	 
		 
		
			
	
						9 years 11 months ago				#4371
		by kalixo
	
	
		
			
			
				Hello Experts! 
 
I did some changes on my site and I found out that I have some stange links indexed.
Example of wrong link:
website.com/4958-articletitle.html
so it is:
website.com/articleID-articletitle.html
and I need to remove this "articleID" from the link. I tried to build that but I don't have this super power 
 
Ps. I will change url suffix option soon, so it will remove the ".html" suffix. Could you please help me with redirect also without suffix .html?
Thanks!			
 
	 
			Please Log in  or Create an account to join the conversation.
	
		
			 		
													 
	 
	
		
				
	
		Less
		More
		
			
									- 
						Posts: 3194					
- 
						Thank you received: 441					
- 
											
- 
											
 
	 
		 
		
			
	
						9 years 11 months ago				#4376
		by admin
	
	
		
			
			
				Hi,
assuming that for website.com/4958-articletitle.html the CORRECT EXISTING URL is website.com/articletitle.html and assuming that you want to match ALL URLs like website.com/XXXX-articletitle.html the rule should be the following:
From URL: ^/[0-9]+-.*\.html$
To URL: {scheme}://{siteurl}/{preg_match 2}/([0-9]+)-(.*)(\.html)/i{/preg_match}.html
Request only: true (checked)
The rule is "ready to drop .html", just change as follow:
From URL: ^/[0-9]+-.*\.html$
To URL: {scheme}://{siteurl}/{preg_match 2}/([0-9]+)-(.*)(\.html)/i{/preg_match}
Request only: true (checked)
Kind regards,
Luigi			
 
	 
	
		The following user(s) said Thank You: kalixo 	
			Please Log in  or Create an account to join the conversation.
	
		
			 		
													 
	 
	
		
				
		- 
			kalixo
		
- 
													Topic Author
											
- 
				
	Offline
			
- 
				Senior Member			
- 
				  
		Less
		More
		
			
									- 
						Posts: 45					
- 
						Thank you received: 0					
- 
											
- 
											
 
	 
		 
		
			
	
						9 years 11 months ago				#4384
		by kalixo
	
	
		
			
			
				Dear Luigi,
thank you so much for the solution! 

Unfortunatly I realised that It won't be so ease as I thought.
My "old" links were starting as text "article-title-long-name.html"
but I've changed that to "new" links which are just numbers now (based on date): "15110401.html".
So, the correct redirect must include additional condition - I need only to redirect strings that are started by numeric string, and after it there is "-" and than "letters". So, any string which is only numeric (without  "-lettes") sould be left without change.
I know it's a liitle bit mess, but is it possible?
Have a nice day!
Thanks in advance,
Kalxo.			
 
	 
			Please Log in  or Create an account to join the conversation.
	
		
			 		
													 
	 
	
		
				
	
		Less
		More
		
			
									- 
						Posts: 3194					
- 
						Thank you received: 441					
- 
											
- 
											
 
	 
		 
		
			
	
						9 years 11 months ago				#4396
		by admin
	
	
		
			
			
				
So, the correct redirect must include additional condition - I need only to redirect strings that are started by numeric string, and after it there is "-" and than "letters". So, any string which is only numeric (without "-lettes") sould be left without change.
It is alredy done like this... 
 
			 
					 
	 
	
		The following user(s) said Thank You: kalixo 	
			Please Log in  or Create an account to join the conversation.
	
		
			 		
													 
	 
	
		
				
		- 
			kalixo
		
- 
													Topic Author
											
- 
				
	Offline
			
- 
				Senior Member			
- 
				  
		Less
		More
		
			
									- 
						Posts: 45					
- 
						Thank you received: 0					
- 
											
- 
											
 
	 
		 
		
			
	
						9 years 11 months ago				#4398
		by kalixo
	
	
		
			
			
				Thank you!
It worked. Looking on my webmaster tools, I also notices that I have also a lot of 404 with similar urls:
Example of wrong link:
website.com/category/4958-articletitle.html
so it is:
website.com/category/articleID-articletitle.html
and I need to redirect it to:
website.com/category/articletitle
Given soultion doen't include that condition, so could you please add it to this, or write the second?
Thanks. A lot of thanks 
 
			 
	 
			Please Log in  or Create an account to join the conversation.
	
		
			 		
													 
	 
	
		
				
	
		Less
		More
		
			
									- 
						Posts: 3194					
- 
						Thank you received: 441					
- 
											
- 
											
 
	 
		 
		
			
	
						9 years 11 months ago				#4403
		by admin
	
	
		
			
			
				Hi,
just create a rule for each category as follow:
From URL: ^/category/[0-9]+-.*\.html$
To URL: {scheme}://{siteurl}/category/{preg_match 2}/category/([0-9]+)-(.*)(\.html)/i{/preg_match}.html
Request only: true (checked)
Of course, replace any instance of "category" with the real category name (e.g. news).
Kind regards,
Luigi			
 
	 
			Please Log in  or Create an account to join the conversation.
	
		
			 		
													 
	 
 
	
		
	
	
	
	
	
	
 
	
		Time to create page: 0.150 seconds