I am trying to make an SEO friendly link for a downloads page
using codeigniter hosted on Azure Websites, now this is working:
www.example.com/downloads/viewfile/34
now when i generated this link :
www.example.com/downloads/viewfile/my-nice-file-name-34
the Url rewrite works great locally on a WAMP server, but when deployed to the remote (Azure Webites IIS ?) it gives the error:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I believe that the cause is: dash symbols are not allowed on IIS but is there a way arround ?
After all, i found out that its not the dash symbols that are causing the problem, but the words in the url itself
like yesterday i had www.example.com/downloads/viewfile/example-file-34
to some reason, having your domain-name in the url segments makes that error apear, so i simply replaced "mydomain" into nothing before generating the Url segment
$fileName = str_replace('mydomain','',$fileName);
return url_title($fileName.$fileId);
Now the same link above is www.example.com/downloads/viewfile/file-34 and its working fine.
i also noticed that same behavior is experienced when using some words like : ajax, json.
I hope this would be helful to somone.
In your routes.php file
Find
$route['translate_uri_dashes'] = FALSE;
Replace with
$route['translate_uri_dashes'] = TRUE;
You may need to look also into
URI Routing Codeigniter 3
http://www.codeigniter.com/user_guide/general/routing.html
Codeigniter 2 URI Routing
http://www.codeigniter.com/userguide2/general/routing.html
Related
I moved a wiki install on lighttpd from https://www.example.com/wiki to a subdomain of https://wiki.example.com so I need to redirect anything wiki related to the new subdomain.
url.rewrite-once = (
"^/wiki" => "https://wiki.example.com",
)
This gives me an error 404 not found as the browser is still pointed to the old page.
In addition I would like to add a rule to handle pages people already have bookmarked such as sending
https://www.example.com/wiki/index.php?title=Main_Page
to
https://wiki.example.com/index.php?title=Main_Page
I ended up doing this:
url.redirect = ( "^/wiki/(.*)$ => https://wiki.example.net/$1",
"^/wiki/([^?]*)(?:\?(.*))?" => "https://wiki.example.net/index.php?title=$1&$2",
)
This works on 99% of the site. However there are a few forums threads that do not display correctly now because they are trying to redirect.
This one works and can view the forum normally
https://www.example.net/forums/showthread.php?796166-Wiki-Skins
This one breaks and tries to redirect
https://www.twcenter.net/forums/showthread.php?796105-Wiki-Extensions-amp-Gadgets
While Stackoverflow is a good resource, please also try reading the primary source documentation for the tool you are asking about. In this case, that is lighttpd documentation.
You might consider using mod_redirect to redirect the client. See documentation and examples at https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModRedirect
I'm running a website under TYPO3 6.2 and follow this tutorial in order to migrate my website on HTTPS. For now I got success with :
following typoscript configuration on the root page :
config.absRefPrefix = auto
config.baseURL >
following TSconfig on the root page :
TCAdefaults.pages.url_scheme = 2
.. and everything seem to work fine. But if I edit this parameter :
... website shuts down with infinite redirection loop (301 Moved Permanently). Why ? The result is the same (infinite loop) if I execute this query :
UPDATE pages SET url_scheme = 2
...and same for BE if I make this change :
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] = ‘2’;
You should not use the url_scheme field exactly because of issues like these. In fact this field was dropped with TYPO3v8. Any Page TSConfig related to url_scheme should be removed and you should run an SQL query to fix all existing pages.
Instead you should enforce HTTPS using a redirect in your .htaccess.
Infinite loops like these are usually caused by redirects performed both by TYPO3 and your webserver:
You request the site with HTTP.
TYPO3 redirects to HTTPS
Your webserver redirects to HTTP
Repeat 2. and 3.
For this reason you should also check your existing redirects, e.g. for enforcing www. in your domain.
If I have a URL like this:
http://localhost/Cool Website/
I will get this error:
404 Page Not Found: The page you requested was not found: Cool Website/index
However, when I use underscores like http://localhost/Cool_Website/
CodeIgniter loads as intended. This issue is now manifesting itself after pasting the CodeIgniter folder as a subfolder into our main project which has spaces in its name that I cannot change. (I can and have changed the CodeIgniter project's name to use underscores)
Is there a workaround for this?
Update: solved my issue by changing system files. I am running php 5.3.13.
I went to the URI core file and put this in the _parse_request_uri:
$uri = str_replace('%20', ' ', $uri);
At line 206, after $uri = isset($uri['path']) ? $uri['path'] : '';
This seems to have fixed it. I reverted the change to QUERY_STRING in my config file because QUERY_STRING was empty. This may be a CodeIgniter 3.0 bug. My guess is the 20% wasn't being "considered valid" by the uri code, so changing it back to a real space made it work again as it truly is the proper URL.
I am using codeigniter ,Client try to take the site using http://www.example.com , It shows "Disallowed character error ".But No issues in my browser, the error only shows in client's system.
I got some answer , but it not working for me.
Ref Link : http://wejn.com/blog/2014/10/hunting-down-the-codeigniter-disallowed-key-characters-error/
http://stackoverflow.com/questions/4197976/codeigniter-disallowed-key-characters
Anyone please help me.
Make sure you have added the disallowed charters into your $config['permitted_uri_chars'] it could be that you are missing few charters a-z 0-9~%\.\:_\-&=$
First: copy this$config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-&=$'; into your config.php
Second: Stop and Start local host if on xampp or wamp / lamp etc refresh page.
How can I use HTTPS along with HTTP in codeigniter and in its base_url.
Note sure about the link generation, yet I might be able to help you with the base URL. PHP usually offers you the $_SERVER array which is available within the config files. So instead of hard coding the Base URL I usually make it dynamic using the server URL. Same works with the HTTPS status. Untested but should work:
$config['base_url'] = sprintf('%s://%s/', (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http'), $_SERVER['HTTP_HOST']);
Be careful when using the HTTPS index. I've read about setups where its 1 instead of on. You better probe your server variables using phpinfo().
cu
Roman
If you use Codeigniter 2.0 and above,
You need not to specify base_url in the config file rather if you let it empty, it automatically detects whether it may be a HTTP or HTTPS url.