Magento custom rewrite URL issue with pagination - php

I have a custom rewrite rule in my magento module.
Config.xml
<my_custom_url>
<from><![CDATA[#^/authors/author/([0-9])/([-\A-Za-z0-9.]+)/([0-9])/([-\A-Za-z0-9.]+)/?$#]]></from>
<to><![CDATA[/mymodule/author/books/author_id/$1/category_id/$3]]></to>
<complete>1</complete>
</my_custom_url>
Final Output
from : http://example.com/authors/author/12/john/3/fiction
to: http://example.com/mymodule/author/books/author_id/12/category_id/3/
It works fine but my problem is that in this page has list of books with pagination. If i click on the 2d page in the pagination link, then the URL change to its actual URL.
For example if i click on 2d page, then the URL is
http://example.com/mymodule/author/books/author_id/12/category_id/3/?p=2
I really need like this
http://example.com/authors/author/12/john/3/fiction/?p=2

Related

how create a custom url in wordpress for page with slash like /se/pagename

I added a page in wordpress. Wordpress created a url like
https://mywebsite.com/page-title
but I want to change this url like https://mywebsite.com/se/page-title
My Permalink Settings shows https://mywebsite.com/sample-post/
and website is already indexed on google so I can't change my paramlink setting.
I also tried with htaccess and also from wordpress add_rewrite_rule() but no result is coming.
Any help how can I do this?
The simplest way to make your page url like www.example.com/se/se1 instead of www.example.com/se1 is to create page se and se1 make as child page of se.
With this option you'll saved your wordpress website permalink structure, you'll in not need to change your other pages redirects for google indexing

Friendly URLs in Wordpress - I need to prepare a custom rule for products (.htaccess or PHP)

On my existing website product pages work like this:
https://example.com/product-page/?xsin=418ZU3QNA
I need urls to look like:
https://example.com/product-page/bla-bla-bla-seo-description-no-specified-length-used-as-product-description/418ZU3QNA
Quick facts:
I have a page created in wordpress, with slug=product-page, I'm passing a product id by ?xsin=418ZU3QNA

To display category,sub-category,sub-sub categories and postname in url permalink in wordpress php

If a post has three categories.parent category,sub category and sub-sub category.when i click on the post i want the url like
category/subcategory/sub-subcategory/postname/
I updated my custom permalink structure as
/%category%/%postname%/
But i m not getting the required permalink.I searched a lot and i got some functions.I used that rewrite rules function.nw the post url is coming correctly.bt it redirects to 404 page.Please help me:
Goto Settings->Permalink Settings-> Custom Structure
Add this as custom structure.
http://127.0.0.1/wordpress/%category%/%postname%/
Hope this will work for you.

Change permalink by htaccess

I need a help from htaccess expertise
Need to change url to make it user friendly Here is my url of site for example
http://www.example.com/the-collection/#the-colection1/
Here is my wordpress page http://www.example.com/the-collection
For this page am using 'shortcode' of plugin that automatic add this collection1 with # tag
Here is also pagination come with this plugin then url seems link this
http://www.example.com/the-collection/#the-colection1/page1
What I need I want to make my url like
http://www.example.com/the-collection/page1
I want to remove that #collection1 (only want to remove not replace with any other text because that i can do from backend easily)

Magento custom URL Rewrite always matches category page after re-index

I have a blog MODULE installed on my Magento and it's URL is /blog.
I have a Blog CATEGORY in the nav bar with the URL /blog-away.html
I tried the URL Custom Rewrite and it works, until you re-index the site, then it reverts back to the category URL of /blog-away.html. I want the category to stay redirected to /blog.
Observations:
the blog module does not use table "core_url_rewrite" - a least I didn't find any evidence.
if the category and blog URLs are the same ("blog.html") - Magento routing will always first match the category and open the category page, you will never get the blog page.
if the category has URL "blog.html" and the blog has, like, "wine-blog.html", you can't create a custom redirect from "blog.html" to "wine-blog.html". Magento will throw an error: "Request Path for Specified Store already exists." (the category's request_path is "blog.html")
So, given all that, I think it may work by setting up a redirect in the shop's root .htaccess file. But I've no clue what code to put in.
From your question I guess you have edited you URL Rewrite like this
Request Path: blog.html
Target Path: blog
Please follow this tutorial to create a new custom URL Rewrite with
Request Path: blog
Target Path: catalog/category/view/id/{blog category id}
And keep original URL Rewrite of Blog category as it is. Then since our custom URL Rewrite path is dependent on actual Category target path so Re-indexing won't effect it.
In
system->configuration->catalog
search for search engine optimizations
Edit product URL suffix and category URL suffix fields, replace .html to any other value or remove it.
Or use optimise web extension.

Categories