Codeigniter Url Rewriting without any controller or method or any other word except domain name/ product name - codeigniter-routing

I need to change my Url's from http://www.website.com/controller-name/method-name/id/
to http://www.website.com/Art-Coupon-Codes this is a single example.How can this be done in codeigniter

Related

Redirect url if Contains Query String to new URL and Pass Sting

I have a url https://example.com/registration-free/?member_id=1234&code=0e9236c500453e3c624ca96939f8aabf and this is a conformation link for a subscription process, but I want to locate this to another page and pass the variables, using regex in either htaccess or yoast pro for wordpress
the new page would be https://example.com/registration-step3/?member_id=1234&code=0e9236c500453e3c624ca96939f8aabf
But if someone goes to the page https://example.com/registration-free/ and there is no query string I don't want to redirect them.
Is this possible, so to clarify, if the initial page has no query string it doesn't redirect, but if a query string is present it redirects and passes the variables to the new url, using htacces or regex in wordpress yoast pro

Redirect url regex

I need to make some redirections in a wordpress site with "Redirections" plugin that allows only regex. Exactly i need to transform this url model:
http://example.com/cat1/subcat2/subcat3/subcat4/bar/this%20is%20page?start=130
To:
http://example.com/bar/this-is-page
Only if "bar" is in url. Anyway, last segment can be like this /page.
How can i obtain that result?

Extract URL value if has sku in the url

I am having a url like
http://192.168.1.5/wpp/base/product/sku/4t4tsdg
if sku word is present in the url i need need to extract the value 4t4tsdg using regex. i am using in wordpress
i tried using /product/sku/(.*/?)$ but unable to get it
php code i used in wordpress
add_rewrite_rule('/product/sku/(.*/?)$', 'index.php?product_sku=$matches[1]', 'top');

django dynamic scraper range_funct pagination

I am using django-dynamic-scraper in one of my applications, I have gone through the docs and following is my setup:
object class url I am using is : http://www.example.com/products/brandname_products.html
The pagination on the site is something like the following.
page 1: http://www.example.com/products/brandname_products.html
page 2: http://www.example.com/products/brandname_products2.html
page 3: http://www.example.com/products/brandname_products3.html
page 4: http://www.example.com/products/brandname_products4.html
The brandname in the above urls is dynamic and depends on a brand's products page. I cannot have a different scraper for each brand as there are over 10000 brands so I am trying to use a single scraper object.
In the scraper object that I am using I have defined the pagination options as follows:
pagination_type: RANGE_FUNCT
pagination_append_str: _products{page}.html
pagination_page_replace: 1,100,2
but the scraper requests the following pagination urls
http://www.example.com/products/brandname_products.html_products2.html
http://www.example.com/products/brandname_products.html_products3.html
http://www.example.com/products/brandname_products.html_products4.html
Instead of
http://www.example.com/products/brandname_products2.html
http://www.example.com/products/brandname_products3.html
http://www.example.com/products/brandname_products4.html
Q: Why is it appending the replace string to the end of the url instead of actually replacing it with _products.html in the object class url ? What am I doing wrong and how can I fix this.
The pagination_append_str option is called like this, because the string is appended to the base url and not replacing it! :-)
So everything is correct, you just have to remove _products_html from your base url so that the final url is build together without doubling url parts.

Django pagination - nice urls

I did pagination in my django projet. Everything works just perfect, but my urls looks terrible, like
host:8000/?page=1
How to create nice urls like
host:8000/page/2/ or host:8000/2/
I use standard Paginator class via ListView
How to do this w/o third party code ?
If you define url pattern like this:
url(r'^/page/(?P<page>\d+)/$', 'myapp.views.list_view'),
then ListView will pass page url keyword into paginator.
Notice:
Each path segment is supposed to be a valid resource, so it's not clear what you will display on /path/ URL.
Django pagination system assumes that webpages will default to using the URL query, so it's recommended to keep it as a URL query and it's more revealing.