I was using .htaccess to serve pre-rendered pages inside my cache dir otherwise the requests is redirected to my CakePHP application.
I have this structure in my public folder:
/cache/
/index.php
Every request to my Application is rendered to the cache dir in the way that /categoria/product-123123.html is saved into /cache/categoria/product-123123.html, until here everything is ok, the problem is: now I want to serve /cache/categoria/product-123123.html for every requests to /categoria/product-123123.html
Could someone explain to me how to use .htaccess to do that or other way.
Regards
Related
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?
URLs on my subdomain like react.mysite.com/page1 go to mysite.com/404.html, when refreshed, instead of the appropriate React component.
Can i have a seperate .htaccess for my subdomain? If so what would I write in it so it would look at react.mysite.com and let that handle the rest of the url?
I'm relatively new to React and SPA, so any help would be greatly appreciated.
So you can have multiple .htaccess files.
And the rule is available in this question:
Apache web server doesn't allow me to refresh on /about but on localhost its working fine
I'm trying to limit access to a directory based on the results of a php script. I have the following in my .htaccess folder where the files are located:
RewriteCond %{REQUEST_URI} !=league_access.php
RewriteRule .* league_access.php
I have also tried:
RewriteEngine on
RewriteRule .* league_access.php
If you go to the directory http://www.bowling-tracker.com/bowl/league_documents/1/ you will note that it is firing the league_access.php script (as it currently only types "Running the Test Script
Restricted access" to the page.
So that is acting correctly.
http://www.bowling-tracker.com/bowl/league_documents/1/test.html you will see that you're granted access to the page (rather than it going to the league_access.php script).
This website is on FastComet (public hosting company) so I cannot change server settings or files except the .htaccess file.
Any help to resolve this would be greatly appreciated.
Thanks....
FastComet Team here! Part of our shared hosting environment is utilizing NginX as a reverse proxy to the Apache web service. This configuration gets the advantages of both services at the same time and ensures a better performance of your project. NginX is processing all requests for static content, such as PDF files or HTML pages. Here's a list of all file types that will be processed by the NginX service:
3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso
However, if the request is for dynamic content, such as a PHP script, it will be passed from the NginX to the Apache service. You are correctly setting the rule in question in the .htaccess file of your website, but this file is only read by the Apache service, not NginX. In other words, if there is a request for a static content, such as a PDF file here:
http://www.bowling-tracker.com/bowl/league_documents/1/Rules_Thurs_Night_Mixed.pdf
or an HTML page here:
http://www.bowling-tracker.com/bowl/league_documents/1/test.html
it will be processed by NginX without considering the .htaccess rules that you have set. There is an easy way of resolving that by excluding the processing of HTML, HTM and PDF types files for your domain or even your entire hosting account. This way, those requests will be processed by the Apache web server, instead of NginX. In this case, the .htaccess rules that you apply will be taken into consideration by the system and they will work without any issues.
I've got a dynamic website. For some reason, I want to serve it as static html files, on a web-host with no database.
The url pattern is:
mydomain.com/post-id/article-post-id.html
My website has about 800 posts. I've saved all my posts into a single folder on my PC:
/articles/article-1.html
/articles/article-2.html
/articles/article-3.html
etc.
It's difficult to create 800 folders and put each file in the corresponding sub-folder. So I have been looking for a code to do the following but ended with nothing that works:
Say the requested url is mydomain.com/345/article-345.html and the server serves /public_html/mydomain.com/articles/article-345.html
How to accomplish this using mod_rewrite and .htaccess?
Create a file in the main directory of the website named ".htaccess". Then, write this in it and save it.
RewriteEngine on
RewriteRule ^([0-9]+)/.+\.html$ articles/article-$1.html [NC,L]
I am having configuration settings with my multi website magento setup.
I have a website running at abc.com . Now for international storefront I have created another website, store view and store with abc_international as the website code.
In my configuration, I have configured Base URL as abc.com/int/
However, when I access the URL abc.com/int/ it generates a 404 error.
Another important point is even if I specifically make changes in index.php as follows -
$mageRunCode = "abc_international";
$mageRunType = "website";
Mage::run($mageRunCode, $mageRunType);
Any ideas as to what might be the problem.
You need to copy index.php and .htaccess files to abc.com/int/ at server and provide particular path to Mage.php file at index.php which is inside abc.com/int/ and in that index.php file you need to modify Mage::run($mageRunCode, $mageRunType); to Mage::run("abc_international", "website"); then it will work if you properly configured multi-website setup.