Yii Url Rewrites - url-rewriting

I got static pages to rewrite by modifying the urlManager like this.. 'login'=>'user/login'
which allows www.site.com/user/login.php to display as www.site.com/login.php
The goal is to be able to take user/ out of everything under the user directory.

Allright to fill in the blanks here...a solution
'<_a:(login|index|update|etc)>' => 'user/<_a>',

Related

Drupal 8 - Overwriting a specific view page

I have created a view with several pages. As it is displayed to me with the debug mode, I can also use the view:
views-view-fields--foobar.html.twig
Overwrite With me the whole then looks as follows:
views-view-fields--nd-portfolio-filter.html.twig
Now I would like to overwrite a certain page of my view. I can't find anything suitable in debug mode.
According to https://www.drupal.org/docs/8/theming/twig/twig-template-naming-conventions it should work according to the following pattern:
views-view-fields--foobar--page.html.twig
according to this logic it should look like this with me then as follows:
views-view-fields--nd-portfolio-filter--theaterfotos.html.twig
Unfortunately, that doesn't work. "theaterfotos" is the system name of the page of my view.
Do I have a thought error now? Would be grateful for any help.
Thnx Bavra
As of my understanding of your question you want to apply to the template on a specific page of view.
Your logic is right but I think your name was incorrect it should be in this format
[base template name]--[view machine name]--[view display id].html.twig
on your case, it should be like below because views machine name not using "-"(dash in between) on lowercase and underscores
views-view-fields--nd_portfolio_filter--theaterfotos.html.twig
you should try this and clear the cache of drupal. Hope this will helps you
Thanks

How to apply condition for specific page in magento?

I want to apply condition for specific page coming from url. It is neither a category page nor a custom cms page. Url is like localhost/project/index.php/news/blog.html. I want to apply condition for this 'news/blog.html' . News or blog is not a category and not any cms page. Can anybody help me?
It depends on the type of condition, you want to user over there. You can try with the following.
1. Try to put a observer in the relevant controller using the cheat sheet https://www.nicksays.co.uk/magento-events-cheat-sheet-1-5/
2. Directly try to edit model in the module of that page.
3. Try to put some code directly into the file.
Thanks,
Use the following code.
Mage::app()->getRequest()->getControllerName();
It will give controller name to your module. Put consition for this name and write your code. It will work for sure.

Codeigniter - Is it possible to redefine anchor function

I have human friendly urls without index.php. I had to modify .htaccess file for that. Actually I always use Codeigniter like this. My url-s always look like this:
www.example.com/controller/function/parameter
So if I have an extra url parameter, then the url looks like this:
www.example.com/controller/function/parameter?archive=2013
Now what I want to do: If there is 'archive' parameter in the url, than also add that to the url when anchor function creates a link.
We have some different stuff every year (like stylesheets), so I need to make this navigation automatic. Am I thinking in the right direction?
And the answer is "Yes".
I slightly modified the solution from here:
How to extend anchor() function to anchor_admin() in CodeIgniter?

redirect image to different image htaccess

I have tried cpanel redirect but it is not specific. I made a change to my site where anyone using a now old image needs to show a new image. I would like to redirect the link to the old image to the url to the new image.
I have an image
http://mysite.com/images/image.png
When the image is called I want to show
http://mysite.com/images/image.gif
What do I add to htaccess to create this specific rule?
Note that image1 is a png and I am replacing it with a gif so I cant just overwrite with the new image. This is why I am looking for a redirect solution.
EDIT: I can give the image the same name, it will just have different extension.
EDIT 2: change to show image would have the same name, different extension.
A simple URL rewrite should do the trick!
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^images/([a-zA-Z0-9]+).png$ images/$1.gif
Whatever is entered here '([a-zA-Z]+)' will be entered here '$1'. Hope that makes sence.
Let me know how you get on!
(Note: there is no rewrite condition to check if the file exists because you want the url rewritten whether there is a file there or not)
Edit:
Probably best to put a .htaccess in the images directory, in this case you can miss out the file paths as you are already in the directory.
If you're looking to replace this one specific image1.png to image2.gif, then this rule should work:
RewriteRule ^images/image1.png$ images/image2.gif [NC,L]
If you're looking for something more general-purpose, then it depends on your image naming.

Magento: Rewriting URLs dynamically depending on conditions?

I have this problem:
I have a default route that looks like this: .../myapp/index.php/config/configuration/test/product_id/51
As you see, this leads to the ConfigurationController and in there to the testAction function. Thats fine and it should stay this way. What I want to change though is the "config part" of the URL.
So instead of
http://somedomain.de/myapp/index.php/config/configuration/test/product_id/51
I want
http://somedomain.de/myapp/index.php/furniture/configuration/test/product_id/51
to lead to the same location (ConfigurationController and in there to the testAction function). The part that is changed, is not static, its the attribute set name of the product. So instead of furniture it can be computer or something else. I can already get this from the product, So all I need is the rewrite stuff.
Ideas how to do that? THANKS!
In the module's config.xml you can change the frontend/routers/your_router/args/frontName which will allow you to use a different name (like furniture). If its an adminhtml controller, you have to use an adminhtml router but the rest is the same.
You can use a router, just like Magento does for CMS pages (explained in the second part of this article : http://alanstorm.com/magento_dispatch_admin_cms_default_routers)

Resources