I currently have a broken site structure that needs repair and I want to do it without doing much damage to whatever little SEO we have currently.
What I have is .com/doctor/office/route/values/here
What I want is .com/doctors/route/values/here
I'm guessing I can just set up a "doctor" controller to redirect all traffic to a "doctors" controller, but I need to make sure that the route values come across properly. I want to make sure it's a 301 to update all of my indexed pages.
Is there something built into Zend to do this easily? Or am I going to have to hack something nasty?
Seems like there are essentially two requirements:
Old urls get redirected to new urls.
New urls get handled by old controllers.
So:
Create a DoctorRedirectController with redirectAction()
Reroute the old urls to the redirectAction(). If you were using default routes before, then add a custom route that maps your old pattern to this new redirectAction. If you were already using custom routes, then just point them to this new redirect controller.
The redirectAction() builds the corresponding new url and does a 301-redirect.
Add routes that map the new urls to the old controller/actions.
No Zend magic, just the grunty work of remapping.
Related
Ive inherited a project created using Zend.
I need to move the site to a new server, same platform but with a new base URL and domain.
Currently if I go to www.domain.com/index.php the first page of the site will be correctly pulled up. No other pages work.
On the old site, the url convention worked like this: www.domain.us/module/view
So for example the index page could be pulled up by going to www.domain.us/index/index
Im sure this is a simple issue of changing some path or setting (the include path, application path and application environment are dynamically generated and appear to be correct) but I have not been able to find anything.
Where does zend decide what controller to include? Is this url convention of using the subdomain to determine the controller standard and if not any hints as to where this logic might be?
We are developing a CMS. This will have a template system, so for example, if the admin wants to add a news section, then he will have to create a template for that section, and another one for each news, that is, for instance, /news/:int:/:title:/, but that route will be stored at the database... how can I do it?
You could use a common controller as a fallback route so that it catches all routes that the admin might create. This controller then goes on to read the appropriate template and show the data.
I was just wondering why no code-behind or helpers were made to work with layouts? I have stuff I want to display in my layouts without having to set it up in a placeholder for every single controller.
I was also wanted to know what is the best way to persist a display-once "success-message" across many pages. For example, a user fills out a form and when it is submitted correctly they are redirected to another page. I want the user to see a success message on that other page. Is there some sort of provision in Zend Framework that makes this easier?
Well for the messages you can use the Flash Messenger helper
As far as setting up the place holders you could use a base controller and set these up in the init method overriding on descendents when necessary.
I have this gwt app which say, runs on http://mygwtapp.com/ (which is actually: http://mygwtapp.com/index.html)
The app host a database of users, queried by searching usernames using the search view and results are shown in the user results view. Pretty useful enough. However I need to bb add a way that user view can be viewed by just typing http://myapp.com/user123
I am thinking that the question I have here, the answer is a server side solution. However if there's a client side solution, please let me know.
One fellow here in StackOVerflow suggested that the format would be like this:
mygwtapp.com/index.html#user123
However the format is important to be like: http://myapp.com/user123
The 'something' in 'http://host/path#something' is a Fragment identifier. FIs have a specific feature: the page isn't reloaded if only FI part in URL changes, but they still take part in browser history.
FI's are a browser mechanism that GWT uses to create "pages", i.e. parts of GWT application that are bookmarkable and have history support.
You can try to use an URL without # (the FI separator), but then you will have a normal URL, that reloads the page with every change and it could not be (easily) a part of a normal GWT app.
mygwtapp.com/index.html#user123
That would be using the History mechanism (http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsHistory.html) which I would add is the recommended way of doing it.
However, if you insist on using something like http://myapp.com/user123, one of the possible ways is to have a servlet which accepts this request (you might have to switch to something like http://myapp.com/details?id=user123). The servlet will look up the DB and return your host html back. Before returning it will inject the required details as a Dictionary entry in the page (http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/i18n/client/Dictionary.html) On the client you can read this data and display on the UI
I want to create an MVC application where by I can create areas of a site that use the same functionality but work under a seperate URL. e.g.
I want to use the same image gallery controller (type not instance) under two different URLs "/Event1/Gallery" and "ProductInformation/Gallery". However if I register this in the routes table and use the html helpers to create links would use the first registration found in the routes table as the link rather than being the actual URL that the controller is serving out at the time.
My questions are:
Is this the correct approach? If not what would be the better solution.
If it is the correct approach how do you stop the helpers from using the first registered controller name rather than the page it is on?
Thanks
Could you use named routes. That way you specify the route name instead of action, controller using the url helper and create the links yourself. Or you could create your own helper method to encapsulate each link.