I'm fairly new to Symfony2 and redirects, I am trying to move posts from an articles section into a new section of a website.
Also, do I just leave the original articles as they (as they are indexed with Google's SEO) are in the MySQL database and create new versions of them in the new section?
E.g.,
original location:
http://example.com/articles
http://example.com/articles/this-is-article-1
new location:
http://exmaple.com/
http://example.com/this-is-article-1
I've come across the following in the Symfony2 Cookbook but I am unsure which one I would use.
http://symfony.com/doc/current/cookbook/routing/redirect_in_config.html
What you can do is to keep your old routing and add new route in your routing yml or annotation to point to the same action in your controller, this way you keep your old routing to articles which are SEO indexed and use your new routes in your twigs so that they get indexed with time, when you feel the need you don't need the old routing you can delete them when the new routes get better SEO.
Another solution which is redirecting as you asked is this :
routing.yml
root:
path: /articles
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: new_route_name_articles_index
permanent: true
This will redirect your http://example.com/articles to your new routing that you created
Related
I'm using laravel.my server is centOS7 and apache2.
This is my routing:
http://example.com/{en}/{county}
But now I want to launch a blog page with url:
http://example.com/{en}/blog
how to add an expected url?
my blog is a wordpress.
Laravel parses the routes in the order they have been added. Try this order when registering the rotues.
http://example.com/{en}/blog
http://example.com/{en}/{county}
It will first match the blog and then move for the patterns.
Now if you run php artisan route:list you will see both the routes have been registered.
by changing the order priority of routes will be changed...
try to use this order in the routes file web.php
.
.
http://example.com/{en}/blog
.
.
.
http://example.com/{en}/{county}
after that, you can redirect to your WordPress site URL:
Route::redirect('/{en}/blog', '/worpress-blog');
I have migrated a website, and now having issues with users that have saved certain pages and pdfs as bookmarks and are now getting broken link errors. I need the links to go to the same areas on the new site.
I assume it will be some type of code needed to be added to the .htaccess.
Here is an example:
Old URL: "www.oldsite.co.nz/things/stuff/thisisapdf.pdf"
Needs to go to
New URL: "www.newsite.co.nz/files/thisisapdf.pdf"
Your help will be much appreciated
I think there are two ways you can go about this using plugins.
1) https://wordpress.org/plugins/all-in-one-wp-migration/
- This is great when migrating or moving sites, as it automatically can repoint the urls for you when you reupload.
or 2) https://wordpress.org/plugins/redirection/
- This will allow you to change the urls on a case by case basis. This is recommended if you don't have too many broken links.
I need make a CMS based en Symfony and the principal work is create subdomains and URIs... any idea where to start? I working with Symfony but I have not done anything like never ...
Thanks !! :)
You should start reading about Symfony2 routing
Then you have to use an A record in your domain administration pointing every subdomain (wildcards) to an specific ip, and editing your .htaccess in order to get an specific response (based on symfony routes) for your subdomains. This post can help you
I have a wordpress website, where I am trying to redirect users to a different page based on a URL parameter. This is what I am trying to solve:-
Current page: - www.mysite.com/hi/
If there is a parameter 'report=show', then I would want the user to be directly redirected to a different page:-
www.mysite.com/hi/?report=show should redirect the user to
www.mysite.com/report If the parameter does not exist, the user should be shown www.mysite.com/hi/
I tried doing a htacess rewrite, but it didn't make any difference.. don't know why!
Not sure why the .htaccess isn't working (as you didn't post it).
Easiest way though is to use the Wordpress Redirection Plugin.
You would add a new redirect rule. Keep the defaults for the other settings, and enter the following two values:
Source URL: /hi/?report=shows
Target Url: /report
I'm working on sample application written with symfony2 and I want to add some cms funcionality (standard manage page entities) and the problem is routing in tinymce wysiwyg editor for links. It will be nice if user will be able to choose route to symfony application page when it want's to add link in the content. Is there a solution / plugin for that problem?
I don't know of a route exposing bundle with a plugin for TinyMCE but you can easily write one yourself with:
FOSJSRoutingBundle
For security reasons not all routes will be exposed by default.
After installing the bundle as described in the README. Expose routes like this:
my_route_to_expose:
pattern: /foo/{id}/bar
defaults: { _controller: HelloBundle:Hello:index }
options:
expose: true