Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to prevent users to view the contents of all html files.
Example:
website.com/join/view_template.html (and it will display all the codes including the smarty)
I would like them to be redirected to 404 page if they do this.
I'm not sure if this is possible in htaccess.
You can use the following line in htaccess :
RedirectMatch 404 ^/.+\.html
This will return 404 not found error for all .html files.
Try it like this although I didn't try it for now,
RewriteEngine On
RewriteRule \.html - [R=404]
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm using CakePhp but I still need to use .htaccess to make special rules for my site's RewriteRule. Ex: if request is with certain filetype (png), then rewrite to certain URL.
Could you help me how to achieve this?
Using Cake PHP shouldn't stop you from adding redirect rules to your .htaccess file.
Check out this similar question for some inspiration. .htaccess for cakephp
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
How could I send an error to the person who tries to connect to my site?
More specificaly, an error that says the site is offline or does not exist.
Example: when you go to: http://aoihjehopejhoitjaephjo.com you'll see "This site is unreachable"
I need my site to show that page.
Does anyone know, how / if it's possible to achieve this?
for a screenshot on the error I need: https://gyazo.com/2c7926238572e73f2757db577bb16bae
If you can use .htaccess you can insert the following lines:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Redirect 500 /
</IfModule>
This will redirect everyone to the internal server error page. You can change 500 to any of the other error codes which can be found using a search engine, or to a directory/page you've created specifically for people to see.
I did it by redirecting my main domain: www.domaindomain.com/index.html to www.domaindomain.com/file.html.
My file.html will display an error message.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Some days back, I have changes WordPress URL's to URL.html via .htaccess. I Know it was very smart move. As google crawled all tne pages, but there were too much 404 error in Webmaster Tools. After some days later I have removes .html from URL. but the real problem happens later.
Now my problem is:
I want to changes the URL.html/comment-page-1 to URL/comment-page-1 (default). I am not good with .htaccess. So please help me.
You can use this redirect rule before other wordpress rules:
RewriteRule ^([^.]+)\.html/(.*)$ /$1/$2 [L,NC,NE,R=301]
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have my website directory like this:
application
assets
system
And under application I got this:
help
contact
I created a file inside each one called index.php so the URL can look something like this, but I have seen so many websites with an URL like this, I've seen this is made with .htaccess file, but the problem is that I don't know where should I put it and how to set it up.
Would be nice if you put some examples.
The apache site has tons of examples.
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
This isn't tested, but something like this should suffice.
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/application/
RewriteRule ^(.*)$ /application/$1 [L,QSA]
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have URL that will be like that :
http://example.com/directory/index.php?q=anything
so that the PHP will load the test variable using $_GET['q'].
I wish to simplify this in my .htaccess to :
http://example.com/directory/anything.html
How would i go about doing this?
May be you could add something like this in .htaccess
RewriteEngine on
RewriteRule ([0-9A-Za-z-\+._]+)\.html$ ./index.php?q=$1
I have Myself resolve this issue ::
here's The .htaccess code
RewriteEngine On
RewriteRule ^directory/([^/]*)\.html$ /directory/index.php?q=$1 [L]