.htaccess

mod_rewrite on apache - language parameter

≯℡__Kan透↙ 提交于 2021-01-28 13:33:21
问题 I have searched for a solution of this problem all over the Internet, read various threads and articles about it but did come to a full solution for my - i think quite generic problem in mod_rewrite. Here is the issue: I have developed a small webapp that lets users make calculations (splitting costs after holidays "who pays to whom"). Now I have come to the point where I want to make it (especially the static pages) language dependent. What seemed like no big deal by passing a get parameter

Why does mod_rewrite redirect to /index.php/index.php/index.php etc

人盡茶涼 提交于 2021-01-28 12:27:57
问题 I want every subdomain to act as a folder, so basicly: projects.dev -> / test.projects.dev -> /test amazing-project.projects.dev -> /amazing-project And I have this code in my Virtualhost file: <VirtualHost *:80> ServerName projects.dev DocumentRoot "D:/xampp/htdocs/projects" ServerAlias *.projects.dev RewriteEngine on RewriteCond %{HTTP_HOST} ^(.*)\.projects\.dev RewriteRule ^/(.*)$ "D:/xampp/htdocs/projects/%1/$1" [L,R=301] </VirtualHost> However when i go to "designs.projects.dev" it gets

htaccess RewriteCond REQUEST_URI detection not working

三世轮回 提交于 2021-01-28 12:11:11
问题 I have two different things I want to happen in the case of two different types of URI's but I can't seem to stop the second case from executing where the first case has already been accepted. Here's an example: abc.com abc.com/asdf abc.com/en/asdf abc.com/zh-cn/asdf/asdf Should all be directed to this RewriteRule: RewriteRule ^(([a-z]{2})(-[a-z]{2})?)(/([a-z0-9-\./]*))?$ /index.php?lng=$1&tpl=$4 [QSA,L,NC] Part 2: abc.com/myadmin/ abc.com/myadmin/asdf abc.com/myadmin/en/asdf abc.com/myadmin

Redirect using Htaccess- URL has underscore and change it to a slash

僤鯓⒐⒋嵵緔 提交于 2021-01-28 11:47:25
问题 I've gone through a couple dozen answers but none seem to give me what I need, hopefully, someone can help me out here... My URL structure looks like this https://www.example.com/this-is-static/random_text_32-11 and I need to redirect to https://www.example.com/this-is-static/random/text_32-11 So it's always the underscore right after "random" that needs to redirect to a slash / Everything after the underscore is dynamic ( random_text_32-11 ) There are other URLs that look like the below and

How to rewrite URLs with .htaccess (removing id?=1)

有些话、适合烂在心里 提交于 2021-01-28 11:41:15
问题 I've looked all over and have yet to figure out how to make this work, I'm sure it's very simple for someone who knows what they're doing. For starters, I have made sure that mod_rewrite is enabled and removing .php extensions is working so I know that isn't the issue. Currently I'm working on a forum, and what I'm trying to do is simply remove the ?id=1 aspect of the URL, so basically making the URL look like such: http://url.com/Forum/Topic/1 Instead of http://url.com/Forum/Topic?id=1

Redirect subfolder request to Passenger

前提是你 提交于 2021-01-28 10:51:01
问题 I want to redirect all requests like mysite.com/subfolder/... to Django application over Passenger and all other requests to the website running under some php cms. File structure: .htaccess subfolder/ .htaccess some cms files Content of root .htaccess : RewriteEngine on ... RewriteConds and RewriteRules generated by php cms Content of subfolder/.htaccess : PassengerAppRoot "/home/username/djangoapplication" PassengerPython "/home/username/virtualenv/webapp/2.7/bin/python2.7" The problem is

Mod_rewrite - change .htaccess into httpd.conf file

房东的猫 提交于 2021-01-28 09:47:07
问题 I have following .htaccess rules which removing .php extension in urls from domain.com/index.php to domain.com/index/ and working fine Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteCond %{REQUEST_METHOD} !POST RewriteRule ^ %1/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*?)/?$ $1.php [NC,L] Now I want to use httpd.conf file instead of .htaccess, but

Remove index.php using htaccess

让人想犯罪 __ 提交于 2021-01-28 08:34:52
问题 I want to remove index.php from url using htaccess. Code Example: Options +FollowSymlinks Options -Indexes RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] For example : If my url https://url.com/index.php then how to make it https://url.com ?. And the 2nd question is, if someone types https://url.com/directory which is contained non-index, then how to redirect them to the

.htaccess redirect to index.php

风格不统一 提交于 2021-01-28 08:09:18
问题 My website : theexample.com I modified my .htaccess so that if visitors visits an unkown url it redirects directly to index.php with : FallbackResource index.php The problem is that it works only if there is one element after "theexample.com". for example : "theexample.com/shudhusdfuisdfhisdfh": works and redirects to "theexample.com/sh/fuisd/fhisdfh": doesn't work and doesn't redirect to index.php. 回答1: You must use absolute path of fallback resource not a relative one: FallbackResource

<If> condition with HTTP_HOST in htaccess breaks PHP

倾然丶 夕夏残阳落幕 提交于 2021-01-28 07:43:16
问题 I'd like to harden my shared hosting webspace to prevent it from rendering PHP with faked filenames like foo.php.wrong as suggested in the TYPO3 Security Guidelines. For details see also https://stackoverflow.com/a/61760273/3946047 Since I don't have access to the Apache configuration I'd like to add the configuration to my .htaccess file. But to make the .htaccess file work on both , my local development environment and in production, I need to wrap the code with a <If> condition to