.htaccess

base_url() and 403 error in CodeIgniter

牧云@^-^@ 提交于 2021-02-09 08:16:23
问题 In HTML view, css link code looks like this: <link href='www.jedendzien.pl/assets/css/style.css' rel='stylesheet'> but my browser is showing adress with double domain adress www.jedendzien.pl/www.jedendzien.pl/assets/css/style.css so i'm getting 403 error. I create link by <link href='<?php echo base_url(); ?>assets/css/style.css' rel='stylesheet'> and in config.php i'm setting: $config['base_url'] = 'www.jedendzien.pl/'; In my XAMPP serwer everthing works fine but problem is appearig only on

Is it possible to query a database using a value passed in a URL, and write the result of the query to the URL using mod_rewrite?

限于喜欢 提交于 2021-02-08 20:56:11
问题 Is it possible to use mod_rewrite to write an htaccess rule that takes a url parameter value (for example: id=1, where 'id' is the parameter, and '1' is the parameter value), query a database with the parameter value specified, and then write the value returned from the query as a part of the url of the requested page? I know the basics of mod_rewrite, for example rewriting a url that appears like: www.example.com/item.php?id=1 to the following: www.example.com/item/1 An example of what I

Ajax not finding url

霸气de小男生 提交于 2021-02-08 16:32:49
问题 Quick question I have been working at but can't seem to get it fixed. I have a ajax call but it is not getting a response from the php file, it seems to be loading a 404 instead. The url in the address bar is "mydomain.com/checkcity/" The location of the file with the ajax is "/php/advert/script.php" The location of the php file to be called is "/php/advert/available.php" I am using virtual urls through the use of htaccess. Here is my ajax call: $.ajax({ type: "POST", url: "/available.php",

Htaccess absolute path

只谈情不闲聊 提交于 2021-02-08 12:49:26
问题 Is it possible to get the absolut path to my ".htaccess" file? Im using this to load init.php in every file. php_value auto_prepend_file /Applications/XAMPP/xamppfiles/htdocs/init.php Is there a way so I don't have to write the absolute path? Like this, if init.php is in the same category as the .htaccess file: php_value auto_prepend_file [ABSOLUTE_PATH_TO_HTACCESS]/init.php and if that is possible, how do I write that but still go back one directory (Since init.php is outside public_html ,

No php extension and pretty url nginx config alternative

雨燕双飞 提交于 2021-02-08 11:37:54
问题 I just migrated my code from apache to nginx server. What would be the alternative nginx config to my apache .htaccess. What i use are rules for removing .php extension and pretty url rewrite. RewriteEngine On #remove .php RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^([^\.]+)$ $1.php [NC,L] #for pretty url RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ index.php?url=$1 [NC,L] 回答1: Try this map $uri $pretty_url { ~/(.*)$ $1; } server { ...

Change url with get parameters to url with path. Wordpress site

ⅰ亾dé卋堺 提交于 2021-02-08 11:25:24
问题 I have a wordpress site. It has a product page that shows some modifications of a product depending on GET parameter given. https://www.officeshop.co.il/product/product-name-1/?build=product-572 https://www.officeshop.co.il/product/product-name-1/?build=product-573 I want to make the url look like this: https://www.officeshop.co.il/product/product-name-1/build/product-572 or https://www.officeshop.co.il/product/product-name-1/product-572 I have tried managing redirects with .htaccess file but

mod-rewrite subdomain to path in primary domain

自作多情 提交于 2021-02-08 10:32:53
问题 I have content from a different server on a subdomain that I would like to use as a subdirectory. Everything from sub.domain.com should be accessible to domain.com/sub I would like sub folders to work as well ex: sub.domain.com/about should be domain.com/sub/about Here's my current .htaccess contents <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(sorry).* - [NC,L] RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule> Any help appreciated. Thanks! 回答1: Enable

Apache Configure CORS Headers for Whitelist Routes

允我心安 提交于 2021-02-08 10:14:27
问题 I'm trying to allow calls made to "/api/whateverEndpoint", while keeping CORS strict for all other calls. I've come across this link Whitelisted CORS using Apache which gives the solution for origin filtering: # e.g. origin = https://host-b.local SetEnvIfNoCase Origin "https://host-b.local" AccessControlAllowOrigin=$0 Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin But i need to adapt this to filter based on the request uri. Any idea is greatly

Nginx config rewrite with PATH_INFO

倾然丶 夕夏残阳落幕 提交于 2021-02-08 10:13:54
问题 I create .htaccess file in folder /var/www/project/ : <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(statics/([a-zA-Z0-9\-\/.]+)|index\.php)$ #ignore folder statics RewriteRule ^([a-zA-Z0-9\-\/.]+)$ index.php/$1 [QSA,L] #Add path_info </IfModule> <Files *.php> Order Deny,Allow Deny from all </Files> <Files index.php> Order Allow,Deny Allow from all </Files> index.php: <?php echo 'Path: ', $_SERVER['PATH_INFO'

htaccess for pretty url slugs

爷,独闯天下 提交于 2021-02-08 09:56:50
问题 I am trying to set up a .htaccess file in the root of my project which will give me the ability to use pretty urls. I have three types of page: news.php tournaments.php rankings.php However, in reality I want news.php and view.php in which the latter will handle which mark up to use for tournaments / rankings and news stories will be site-name/news/the-slug-of-the-story/ Here is what I have so far: RewriteEngine On RewriteBase /the-site-name/ RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %