mod-rewrite

Remove Query String from Rootdomain

梦想与她 提交于 2019-12-13 02:35:35
问题 I know with a simple redirect one (Sub-)Domain or Folder to another i can get rid of a string like this RewriteEngine On RewriteRule (.*) http://www.domain.tld/? [R=301,L] I know how to get rid of it when it is a simple file too. But when it comes to the Rootdomain itself (http://domain.tld/?Stringwhatsoever), i am at a loss here. My last try used a modified version of a redirect I used to redirect files and folders around and that worked pretty nicely and also removed the query, but it ended

Mod_rewrite forward everything to index.php 's params

给你一囗甜甜゛ 提交于 2019-12-13 02:28:44
问题 How can I get anything but files to rewrite to index.php's params? I'm using apache, mod_rewrite, etc. 回答1: If you want to rewrite anything that isn't a request for a regular file I'd use this: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/index\.php -f RewriteRule ^(.*)$ /index.php?page=$1 [QSA] </IfModule> This way you don't need to concern yourself about adhering to a certain URL format for

Append query string to all URLs with .htaccess

放肆的年华 提交于 2019-12-13 02:27:18
问题 For testing purposes, I would like to append a query string (let's say testing=true) to any url requested from my website. E.g. I want to change example.com example.com/product example.com/search?q=string to example.com? testing=true example.com/product? testing=true example.com/search?q=string& testing=true I tried this: RewriteRule ^/?(.*) http://example.com/$1?testing=true [L,R,NE] but it breaks the site. Not an expert. Any ideas? EDIT: I should add I'm working with CodeIgniter (PHP) and

TypeError : Cannot read property 'replace' of undefined

会有一股神秘感。 提交于 2019-12-13 02:25:28
问题 Overview : I would like to redirect the visitor on a default page(index.html) inside the directory structure to display when a directory is accessed using .htaccess file(as of now current directory index.html is loading). But When I turn on $locationProvider.html5Mode(true) in my angular application getting below error. Console Error : Directory structure of Application : public_html --prod --public --app --controllers --directives --services --app.config.js --index.html --.htaccess .htaccess

How to detect if mod_rewrite is available?

时光总嘲笑我的痴心妄想 提交于 2019-12-13 02:24:43
问题 Good day. I have a problem with links in my application. I want to use ' pretty-urls' ,so i want to all my links look like ' www.sitename.com/controller/method '. So i want to print my all my links through one function,which would look like function link($url_segments) { if(mod_rewrite_is_available) return BASE_URL.$url_segments; else return BASE_URL."index.php".$url_segments; } But i can't understand how to detect if server has rewrite module enabled. I have found 2 solutions: Place in

Removing index.php and another page inside the root folder from URL with .htaccess

放肆的年华 提交于 2019-12-13 02:20:43
问题 In my Root folder I have index.php and profile.php . Currently I'm using these rules for rewrite my index.php from example.com/index.php?a=profile&u=user1 to example.com/profile&u=user1 RewriteEngine On RewriteCond %{request_filename} -f RewriteRule ^(.*) $1 [L] RewriteRule ^(([^/]*)+)(/([^/]{0,32})(/.+)?)?$ index.php?a=$1&q=$3 [L] RewriteRule ^welcome/([^/]+)/?$ index.php?a=welcome [NC] RewriteRule ^page/([^/]+)/?$ index.php?a=page&filter=$1 [NC] It works fine but now I want to rewrite my

Get page id value and display in URL via .htaccess

青春壹個敷衍的年華 提交于 2019-12-13 02:06:16
问题 I'm trying to display SEO friendly URLs by using a rewrite in our .htaccess file, but I can't get it to work (I've researched many of the related topics on StackExhange and elsewhere, but to no avail). I'd like to get the value of the id on this page... http://199.119.123.135/info/tool_surety_company.php?id=1 ...and display the id value in the URL instead of the ugly "tool_surety_company.php?id=1". I'm going for a result like this: http://199.119.123.135/info/travelers-group I'm using the

Simple website structure RewriteRule for PHP GET parameters

萝らか妹 提交于 2019-12-13 02:03:26
问题 How can I rewrite the examples below? www.domain-name.com/site-name/index.php?lang=en-us&page=home www.domain-name.com/site-name/index.php?lang=en-us&page=about www.domain-name.com/site-name/index.php?lang=pt-pt&page=inicio www.domain-name.com/site-name/index.php?lang=pt-pt&page=sobre To this: www.domain-name.com/site-name/en-us/home.html www.domain-name.com/site-name/en-us/about.html www.domain-name.com/site-name/pt-pt/inicio.html www.domain-name.com/site-name/pt-pt/sobre.html I managed to

Apache/PHP is determined to serve the wrong file

為{幸葍}努か 提交于 2019-12-13 01:54:10
问题 I have a page that is called with a url like http://testserver/path/to/foo/bar/ but apache is serving the wrong file altogether. /path/to/ is a real directory where all the code and .htaccess file is. foo/bar/ is supposed to redirect to foo_bar.php with a RewriteRule , but it never gets there. It's not a mod_rewrite issue as I have commented out all the rules that could be interfering, which should give me 404s for that request, but the same problem occurs: the file that is served is /path/to

.htaccess : http to https redirection does not work

ぃ、小莉子 提交于 2019-12-13 01:52:52
问题 I have a problem with my .htaccess and https redirection. First of all, I have consulted these links to find a solution but none could help me. List of links : .htaccess redirect http to https ModRewrite with HTTPS https://www.ndchost.com/wiki/apache/redirect-http-to-https htaccess redirect to https://www https://serverfault.com/questions/116206/how-do-i-use-htaccess-to-always-redirect-from-http-to-https When I load the page with http, the .htaccess redirect me to https but when I load the