cakephp rewrite rule for existing website with .htm - .htaccess

How to fix my problem for an existing website converted to a cakephp application. The previous website has *.htm extensions. Is this something what needs to be done in the .htaccess file? The problem is that the website is of course in many search engines with having the *.htm extension, I want to avoid problems like page not found.
Example: www.domain.com/foodhabbits.htm is now in cakephp application www.domain.com/foodhabbits

You could add Router::parseExtensions('htm'); to your app/Config/routes.php file. The router will then remove the "htm" file extension and parse what remains, see also http://book.cakephp.org/2.0/en/development/routing.html#file-extensions

Related

How to make the .htaccess file work bypassing the browser cache?

I'm creating a website, and I wanted to upload a new version to the server. The problem is the .htaccess file.
I changed the file structure. Previously, I had an app folder with index.php in it, and .htaccess automatically removed the ending to make the url look like www.sitename.com/app.
Now app is app.php file, and same .htaccess removes .php to make the url look the same as before.
For users who have visited the site before, the redirection will not work, because it seems that the browser's cache is blocking them (after deleting everything works as it should). I'm still fairly new to web development, so is there any option to prevent this?

Convert osclass htaccess file to web.config to run Php on IIS problem

host=windows
Enabled friendly URLs in osclass, but there is a problem , friendly URLs aren't working, and I know the problem comes from IIS webconfig file. Is there anyone using osclass on windows? And how does the problem resolve?
I'll give you one of the problematic links :
https://test.com/search/pattern,تست
As far as I know, if you enable the friendly URLs, it will add the url rewrite rule into the htaccess file.
IIS url rewrite rule contains the build-in tool which is used to convert the .htaccess to web.config.
I suggest you could find the htaccess file and add it in below tool.

How to STOP redirecting my website to mobile.mywebsite.com in smartphones

I have developed a website www.mywebsite.com and it is ready to go live.
I have used Codeigniter framework.
When I enter www.mywebsite.com from any android/iphone, it redirects automatically to mobile.mywebsite.com and displays page not found error. I dont have any mobile site developed for this. I want to show the main site even on the smartphones.
I am not good at .htaccess file, and I am using default .htaccess to remove the index.php in the url.
I tried creating a subdomain mobile.mywebsite.com and pointed to root path. But same response. I search online, but didnt find anything on how to STOP redirecting.
Thanks in advance.
When I was uploading my local files into the server I was NOT overwriting the old ones assuming the folder is clean and no need to overwrite. But my hosting provider has default .htaccess which is redirecting to the mobile site.
I deleted the old one and gave my .htaccess without the mobile redirection and everything is in place now

single-page application with clean URLs without .htaccess file?

My question pertains specifically to the two pages below, but is also more generally relating to methods for using clean URLs without an .htaccess file.
http://www.decitectural.com/
and
http://www.decitectural.com/about/
The pages above are hosted on Amazon's S3, which does not allow for the use of htaccess files. As a result, I have found no easy way to create a clean url rewrite scheme that sends all requests to an index file which, in turn, interprets the URL using javascript and loads up the correct page (with AJAX, or, as is the case with decitectural, with simple div visibility toggling).
In order to circumvent this problem, I usually edit the amazon S3 bucket properties and set both the index page and the error page to the index.html file. In this case, the index.html file is served even when an invalid path (such as /about/) is requested. This has, for the most part, been a functioning solution... That is, until I realized that I was also getting a 404 with the index.html page which would stop Google from indexing it.
This has led me to seek out an alternative solution to this problem. Currently, as a temporary fix, I am actually creating the /about/ directory on the server with a duplicate of the index.html file in it. This works, but obviously is not a real solution to the problem.
I would appreciate any advice on how to set up a clean URL routing scheme on S3 or in any instance where an .htaccess file can't be used.
Here's a few solutions: Pretty URLs without mod_rewrite, without .htaccess
Also, I guess you can run a script to create the files dynamically from an array or database so it generates all your URLs:
/index.html
/about/index.html
/contact/index.html
...
And hook the script on every edit, in a cron or run manually. Not the best in terms of performance but hey, it should work.
I think you are going about it the wrong way. S3 gives you complete control of the page structure of your site. If you want your link to be "/about", just upload a file called "about", and you're done. (Set the headers so that the browser knows it's HTML.)
Yes, it will break if someone links to "/about/" or "/about.html". But pretty much any site will break if you mess with their links in odd ways. You will have to be vigilant when linking to your own site, because you won't have any rewrite rules to clean up for you. But you should have automation doing that.

How to use htaccess for content negotiation?

In order for the content to be available through the same link, even if the file extension has changed, URI's shouldnt change. So i decided to use content negotiation and htaccess to achieve this. I searched the web but all i found out about is how to implement this specific to php. In my site i have not only php but also html, images and javascript files.
How can i use content negotiation with just htaccess?

Resources