URL Rewrite in joomla 2.5 - joomla2.5

I have a URL :
http://localhost/test/profile?view=trainings&layout=details&id=MjQ1
id -> MjQ1 is a record id
i need the Uto be rewritten as :
http://localhost/test/profile/trainings/record-title

use a a SEF extension. sh404SEF is one very good choice and there are others.

Related

RegEx: Rewrite URL with exception

I am trying to change the permalink structure of my Wordpress site and setting up proper redirects. Here is what I am trying to achieve:
Old permalink structure:
/category/post-name
New permalink structure:
/postname
Redirecting would be fairly simply done by:
Source:
/category/(.*)
Destination:
/$1
However, the base URL without the post-name must not be rewritten. So if someone access /category directly (without specifying a post-name) it should not redirect, because /category is a valid page. It should only redirect if something is following /category.
Example:
https://somesite.com/category -> Don't redirect
https://somesite.com/category/post-123 -> redirect URL to https://somesite.com/post-123
Any ideas how I can do this? Note: I am using the Yoast Plugin and its RegEx redirect option.
I am not a coder, so sorry for my gibberish. I hope I am making some sense.
Thank you! :)
Use .+ to match at least one character:
/category/(.+)

301 redirects - replace a section of the URL

I'm re-working a Woocommerce store, and I need to set up redirects that will send the old URLs, which include category names, to the new URLs, which won't.
EDIT: Both the old and new URLs will contain product/ and the old URL may or may not have a trailing slash.
An example would be:
Old URL: myshop.co.uk/product/category-name/sub-category-name/product-name
New URL: myshop.co.uk/product/product-name
Can anyone tell me what the reg exp would be to achieve this?
Search for (?<=product/)(?:[^/]+/)+(?=[^/]+/?$) and replace with an empty string.

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?

Apache & NGINX Redirects

How do I redirect to remove all intermediate folders between the domain name and the .html file name without explicitly adding multiple rules per redirect.
basically I want both:
example.com/category/product.html
example.com/category/sub-category/product.html
to redirect to
example.com/product.html
I would also like:
example.com/category/subcategory.html
to redirect to
example.com/category.html
I don't have a logical way to differentiate between a subcategory.html and a product.html, so I am open to explicitly matching (or not matching) to list the sub-categories.
I would like to accomplish this for both apache and nginx styles of rewriting.
You can use these regex in this order:
^\/(category)\/(subcategory|subcategory2|subcategory3)\.html$ -> /$1.html for redirecting example.com/category/subcategory.html to example.com/category.html. See Online
^\/(category)\/.*?([^\/]+)\.html$ -> /$2.html for redirecting example.com/category/product.html or example.com/category/sub-category/product.html to example.com/product.html. See Online
You can replace category and subcategory with actual values.

Django using mod_wsgi for Sub Urls

Similar questions have been asked before on this site, but I had a doubt as to how my site anchor tags will be replaced when I try to host my website under a suburl.
E.g.
My domain is www.example.com
and my suburl which maps to the Django installation is www.example.com/2010/registration
Now since the anchor tags in my templates (for the links) are of the form of a '/' (to reference the root) succeeded by rest of the url the links are not contained inside www.example.com.
So, for example if my anchor tag is of the form
<a href='/profile'>Profile</a>
Then my anchor tag on the site becomes www.example.com/profile instead of becoming www.example.com/2010/registration/profile/
Is there any possible way to work around this thing ?
Thanks,
Nitin
There are tags which can be used in templates to ensure correct prefix added. Start by reading:
http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#url
As Graham says, use the {% url %} tag in your templates. In views, use the reverse() function, which is equivalent. See the documentation.