Magento 301's with PHP code aquire Seo Url? - php

I am looking to migrate a website from Cubecart 4 to Magento 1.8. I have created a script that grabs the old cat id from the url, then searches the database to where this is stored (I copied them over) It then grabs the new magento category ID and then needs to grabs the URL of that category. I then want to make a 301 redirect from to the new url.
I cant grab the SEO url from the ID however. So far I can grab the un written url from the id with this where $caturl2 is the category id.
Mage::getModel("catalog/category")->load($caturl2)->getUrl();
Is there anyway to grab the seo url by ID? Any ideas?
At the minute it's outputting: /catalog/category/view/s/cat-name/id/4448/

To get the full SEO url, stored in URL rewrite management tables, you should use the follwing code.
Mage::getModel("catalog/category")->load($caturl2)->getUrlPath();

Related

how to block category in wordpress url which is automatically generated

I am facing issues in wordpress i don't unterstand how to resolve if i have publice a post then
Generated URL is - https://www.example.com/blog/benifits-of-marketing
if we have 3 item in menu bar like finance, design, marketing then
Automatically generated url - https://www.example.com/blog/benifits-of-marketing/finance
https://www.example.com/blog/benifits-of-marketing/design
https://www.example.com/blog/benifits-of-marketing/marketing
How to block this Automatically generated url
Trying to remove it through htaccess using But i have 100+ pages...so one by one is difficult

How to add slug in URL according to SEO Prospective in Cakephp

Hello i have a problem related to url in cakephp website for example my current url is http://example.com/categories/1 when i click on any category it opens up with id.But now i want to change structure of my url like http://example.com/abc where abc is my category name,i have lots of category so anyone suggest me how to achieve this structure in cakephp.

Wordpress permalink to allow title variable in

So I built a site (In the wrong way which I can see now).
Users can post ads, they are not stored as a post, I just store the information in a table in the database.
I use a page template with parameters passed in - For example www.site/ad/?id=1&cid=2
id = id from database
cid = category id from database
I then use a wordpress page, pull params from url and load all information from DB relating to the id and category id.
In the wordpress admin there is a page set - the page uses an ad detail template for all urls that are www.site/ad/?
What I want to do now is put the ad title in the url so www.site/ad/adtitle/?id=1&cid=2
The issues with this is the page will not load as the permalink now does not correspond
perma link is www.site/ad/?
so cannot use www.site/ad/adtitle/? and still load the page with template.
I guess the question is can I make so that the page will load the url with the ad title in
I try to set permalinks to allow custom structure but no luck
Apologies about title didn't know what to call this
Fixed it with pods, which will allow you to use a page referencing a part of a url
http://blog.stefanxo.com/2014/02/how-to-create-a-pods-page/
Thanks

Old/new website - same category URL! What to do?

I have a problem. I bought an old domain name and I redirected all my content to it now.
So I have this category as example: http://www.formulawahad.com/category/news/ (or simply formulawahad.com/news/)
So any news link is like this: http://www.formulawahad.com/news/37329/
(My wordpress installed is not in the root - inside a folder).
Today, I got all the files from this domain which goes back to 2001. And Google found like 2000 errors. Now I want to upload them and make them available as they have a lot of backlink.
But the problem is the link of the old articles are like these:
http://www.formulawahad.com/news/090217_coulthard.htm
Or: http://www.formulawahad.com/news/080623_trulli.htm
So what do I do? create a "news" folder and place all html files in it? but then what will happen to my wordpress category formulawahad.com/news/?
I have the same problem with 2 more categories. So I need your help before I decide what to do.
Thanks a lot.
This is simple to get rid of those 2000 errors in google. In wordpress init() hook you have to make a redirect function. In databse add a table with old and new url,get url and search with old url and redirect it to new one.

Custom WordPress URL Structure

I'm trying to ensure the WordPress site I'm working on maintains consistent URLs. The problem I'm having is with child pages and custom post types.
Essentially the setup is as follows.
/main-page/sub-page/
Main Page
-- Child Page
This is fine, however I have a custom post type (research-papers) I'd like to list on the Child Page. I've got this working fine. The problem I'm having is getting the research papers post type to use the following URL structure:
/main-page/sub-page/research-paper-title/
I've looked at wp_rewrite_rule but I can't get anything working. Any ideas?
add_rewrite_rule(
"main-page/sub-page/([^/]+)/?",
"index.php?research-paper=$matches[1]",
"top"
);
Change the first parameter from
"main-page/sub-page/([^/]+)/?"
to
"main-page/sub-page/([.]+)/?"
The way it's set up now, you are searching for the pattern "main-page/sub-page//...", with 2 forward slashes after "sub-page", which isn't going to catch anything.

Categories