create rewrite rules only for one specific folder - php

I am using WP site. its working fine. but i have one issue that is i have created a folder that is myfolder. In this folder i have created index.php file and added some JS and CSS files. so now my site link like below.
http://www.domain.com/myfolder/index.php?ver=52
Now i am working for increase site speed task. I want to enable gzip for this folder. so i think htaccess is the fine for increase speed of site. So i want to create rules only for this folder. when i will add condition rules only work for this folder then i can enable gzip for this folder. I am new in htaccess. So please let me know how i add condition and rewrite rules from htaccess from site htaccess file only for this folder.

Related

Legacy Wordpress Multisite not displaying images on the frontend and Media library on subfolder sites

I have upgraded a legacy Wordpress Multisite that uses the this line in the htaccess file to upload images to the blogs.dir directory. This was the original way it was done.
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
More info here:
https://anchor.host/removing-legacy-ms-files-php-from-multisite/
Everything works in regard to uploading images to the subfolder sites. The images are stored in the blogs.dir in the wp-content folder. However they do not display on the frontend and in the media library. But they are physically in the blogs.dir folder as they should be.
This is not visible
https://example.com/akdn/files/2021/10/synapticDensity-updatedOct2021-768x573.jpg
But this is visible:
https://example.com/wp-content/blogs.dir/2/files/2021/10/synapticDensity-updatedOct2021-768x573.jpg
So basically on the frontend the rewrite of the URL is not being done. I am not sure how this legacy process works in terms of rewriting the URL so the image from the https://example.com/akdn/files/2021/10/synapticDensity-updatedOct2021-768x573.jpg
displays correctly this file.
https://example.com/wp-content/blogs.dir/2/files/2021/10/synapticDensity-updatedOct2021-768x573.jpg
This should be done automatically I assume.
If I cant solve the issue, is there anyone who can suggest a URL rewrite that will work in the htaccess file. Thanks

Multiple .htaccess files

I'm relatively new to htaccess files and I'm trying to get my URL to look SEO friendly.
It says to change my htaccess.txt to .htaccess to allow URL overwrite but I have multiple htaccess files and don't know which to switch and what to do.
My goal is to get from:
http://www.sunshineorlandorentals.com/component/bookman/?PropertyId=1609
to:
http://www.sunshineorlandorentals.com/location/1609
Don't be confused about the multiple .htaccess files. The only file which is working is without any extension that means .htaccess is the right file. You can delete other .htaccess.txt files. Download them before Delete as Backup.
To redirect your current url to new one -- Simply ADD below line of code into your .htaccess file.
Redirect 301 /pagename.php http://www.example.com/pagename.html
Here pagename.php is your old url without Domain name
and pagename.html is new url with same Domain name, Replace example.com with yours one.
And your new Url http://www.sunshineorlandorentals.com/location/1609 is completely Seo friendly. Try to make all your urls like same in future.
Thanks
Just ignore all other files.
You just need to enable sef urls and sef rewrites on Joomla sites (in joomla config setting).
Create new hidden menu with alias 'location' pointing to your component that's it.

.htaccess is being ignored in one subfolder

I have been looking around for hours now and can't seem to find a solution, so time to ask a question.
I got a .htaccess file that is being ignored in a specific subfolder. All other .htaccess files work as they should in their respective folders. I got no specific rules set up for the folder.
The .htaccess file contains Options -Indexes
The root folder is a Magento webshop and the folder in question is two subfolders down.
root/shop/colors/ (colors is the bugged one)
I got a exact copy of the folder structure and files but with different names and that .htaccess works.
root/test/colors/
So why is one .htaccess being ignored but not the rest?
The index.html in the bugged folder where cached and use a manifest file. When i cleared it with chrome://appcache-internals/ It started to work.
So why does appcache prevent .htaccess files?

Using self hosted Wordpress with a 301 redirect

Recently I've been working to develop a multi-user Wordpress site with Wordpress 3.0 however at the moment we are iso.g one server to showcase preview static content in a subdirectory while multi WP is in the root directory.
My question however is how to keep the root directory hidden from the publc. Curntly I have a PHP index file handling he redirect howevwer as WP has its own index file I waned to ask about any possible alternatives.
Thanks very much for any assistance,
You're probably going to want to do it with an .htaccess file. However, Wordpress has one of those too, so rename the current .htaccess file to .htaccess.orig (or whatever you want... but don't delete it) and then create your new .htaccess file with your 301 redirect.
Then whenever you are done, just rename everything back to the way it was.

How can I use a clean URL only in a subfolder of my website?

I have a web site http://www.mydomain.com
Here I have created a sub folder http://www.mydomain.com/products. I want to change all the page inside the product folder as clean URL. I know .htaccess should be inside product folder. If it's enabled, will it affect all the parent directories and files of my site
I mean http://www.mydomain.com/ here, will it affect the pages here also.
I have one more doubt about .htaccess file, is there a way I can enable mod_rewrite through any code code without directly editing httpd.conf file
Please help me
Thanks
i have one more doubt about .htaccess file, is there a way i can enable mod_rewrite through any code code without directly editing httpd.conf file
You place this line before any rewrite rules in your .htaccess file, which will switch on the rewrite engine - no httpd.conf change required.
RewriteEngine on
If it's enabled, will it affect all the parent directories and files of my site
The .htaccess file will only affect the folder it is in and any subfolder of that folder.

Categories