From what I understand, Expression Engine url parsing works like this:
site/template/
I want to deeplink straight off the regular site url, like this:
site/special-deep-link
and I have javascript in place to carry out specific actions.
But EE is just assuming this is a template, and giving me a 404 saying it does not exist (which is true). So naturally the js does not fire and nothing works.
Is there any way to stop EE from trying to parse it as a template without using .htaccess or other server side config settings?
Unfortunately the old codeigniter way of rule routing doesn't seem to be working.
I tried:
$route['site/special-deep-link'] ='';
$route['/special-deep-link'] ='';
$route['index/special-deep-link'] ='';
But sadly none of those seem to work. Any thoughts on this?
Figured it out, using this plugin:
http://devot-ee.com/add-ons/freebie
I was able to have EE ignore that url string.
Related
Our current website is built using AngularJS and as a result has URLs with /#/in them such as http://www.website.com/#/termsofuse
Short-sightedly, the URL for terms or use has been hard coded into a mobile application and although this has been changed, some users still have older versions.
We're moving to a WordPress site (running on Azure) and the new URL for terms of use is http://www.website.com/termsofuse
The issue is that I want to redirect to the new URL if the old URL is used (from the app where it is hard coded in older versions) but I can't find a way to do this with the /#/ in the URL (otherwise I could use HTML/JS at the old URL to redirect).
I have tried searching for solutions on Google and here but although I'm sure someone has had this problem, I'm finding it hard to define the search terms in order to get valuable results.
I also considered posting this on WordPress stackexchange but it is not really a WordPress question, I'm assuming I'll need to use some other method.
Appreciate any ideas or advice. Thanks in advance.
So far I have learnt from responses that I probably need a JS solution and based on that I have found the below which looks similar (at least shows me how to isolate the fragment after the URL). Since my issue is very specific, and I only need to look for the specific fragment #/termsofuse could I use this code (with midifications) to look for that string and redirect based on that?
Checking URL fragment for a keyword
Sadly, this is not possible as everything after the # doesn't get sent to the server.
What many people do in this sort of situation is to use a javascript/ajax solution to load the page.
By your description, as your new web site is built on WordPress without AngularJs.
So it hardly could approach your need in a traditional way. As hashtag # is a client symbol which is never passed on serve, so IIS on Azure will not get the portion after # of the URL, also URL rewrite module won’t see it too.
So if possible to modify home page of your WordPress site, here is a workaround with using JavaScript get the portion after # of the URL and redirect to the right URL.
Here is the code snippet:
(function () {
console.log(window.location.href);
var url = window.location.href;
params = url.split('#');
console.log(params);
if(params[1]){
window.location.href = params[1];
}
})();
I have a Joomla based community site and with search engine friendly URLs activated in the backend my profiles are located under mysite.com/community/profile/user/"username"
I need the htaccess file to do nothing unless a URL containing "community/profile/user" is found. If that string is found then it should change the link to mysite.com/"username" but in reality be showing the page mysite.com/community/profile/user/"username"
I think this would be rewrite rule instead of redirect, but I barely know what I'm talking about.
Can someone please tell me what code I must place in my .htaccess file in order to change this? I believe .htacces would be the best way to do what I need, but if you have another idea I'm glad to hear it.
First be sure you understand .htaccess's role.
It is only read when an incomming request is made. So it will not change URLs generated by joomla.
You can however allow urls like mysite.com/eddie to actually pull content from mysite.com/blah/blah/eddie
http://httpd.apache.org/docs/current/rewrite/remapping.html
If you are looking to "train" your users, you can add a step before that to redirect the URL as well. This get's very tricky though as if you're not careful you can get caught in a loop.
user clicks mysite.com/blah/blah/eddie
apache redirects to mysite.com/eddie
(browsers makes second request, user sees URL change)
apache sees mysite.com/eddie and loads the underlying mysite.com/blah/blah/eddie
An easier solution might be to tweak the joomla community code to generate the short urls (mysite/eddie) and use apache to make a call direct to the plugin (mysite/components/communit/index.php?user=eddie
Recently I've been looking into Opencart as a solution for simple E-commerce websites. I like it a lot, but I can't seem to get the redirection right.
I am using lighttpd as a web server, and I've noticed that Opencart offers Apache .htaccess configuration for SEO URL's, but no luck for lighttpd.
Opencart uses URLs that are formed like this:
Login Page: http://[domain]/index.php?route=account/login
Product Page: http://[domain]/index.php?route=product/product&product_id=51
Ideally, I would like to have something like this:
Login Page: http://[domain]/index.php/account/login
Product Page: http://[domain]/index.php/product/51/[product-name]
Of course, any pointers in the right direction are highly appreciated. Even a short explanation of where to find the right way to handle rewrites in Lighty would be helpful!
Thanks in advance.
A lot of people have had issues with 1 4 19-5lenny and earlier apparently. If you want to rewrite urls the way you have above, you will need to parse them yourself using your own custom hook (see the preAction in the index.php for handling them by default). Note that you will also need to manually edit urls like the account one since they aren't even sent through the url rewriter before being output
I have a perfectly good (so far) setup of wordpress of for a new website. The pretty urls are working as expected.
I have 1 dynamic page that loads content depending on the querystring:
/dynamic/?loc=england&code=uk
I wish to make this URL "pretty" as well but every-time I modify the .htaccess no changes are made. Tried everything and googled everything else - last resort. If I could get the following to work then I would be happy.
I need to make the URL look like.
/dynamic/location/england/code/uk/
Adding this to any .htaccess breaks the whole website.
RewriteRule /dynamic/(.*)/(.*)/(.*)/(.*)/$ /dynamic?$1=$2&$3=$4
What am i missing.
Thanks in advance
N
Don't add the rewrite rule to your .htaccess file. WordPress manages that file for you, so try to use built-in features whenever you can.
WordPress actually has a somewhat advanced rewrite engine that ships standard - and it's pluggable just like the rest of the platform.
The trick, though, is working with it. You'll need to register your RegEx so WordPress knows what kinds of strings to match (i.e dynamic/location/(.*)/code/(.*) => /dynamic?$loc=$1&code=$2). Then you'll need to set up the page and script on the back end to handle the submission.
For a similar example, look at the answer I received to parsing custom URLs with a custom post type over on WordPress Answers. Extending this, you'll need to set up code similar to the following (note: untested!!!):
<?php
add_action('init', 'add_my_rewrite');
function add_my_rewrite() {
global $wp_rewrite;
$wp_rewrite->add_rule('location/([^/]+)/code/([^/]+)','index.php?loc=$matches[1]&code=$matches[2]','top');
$wp_rewrite->flush_rules(false); // This should really be done in a plugin activation
}
This should add the rewrite structure to your .htaccess file automatically.
I have a custom Joomla component and a router for building my SEF URL's for use within the site, and everything is usually shiny - internally, all of my links look and act fantastic.
I recently route a controller action that sends a list of links through email, and I've noticed that my URLs are coming out.... funky - hopefully someone can tell me why.
Usually, my router generates an internal link that looks like this:
http://localhost/Registry/calendar/265889635/Some-Long-Boring-Event
However, when I send an email and preparing the same URL through the same router I get:
http://localhost/Registry/Registry/component/calendar/569555803/Some-Long-Boring-Event
Has anybody run into this issue before?
Check your Itemid GET parameter in the URL. My guess is that it's not set in the url used in emails...
I would turn off SEF URLs temporarily and get the non-SEF version of the link you want. Compare that will the URL you are using and see what is different/missing.