url-rewriting

Rewrite in index.php

好久不见. 提交于 2020-01-25 03:00:39
问题 I have a problem with rewriting hrefs in my website. First of all I managed to remove all .php extensions from na URLs, then I added rewriting all mydomain.com/img?id=X to mydomain.com/img/X, but I have been struggling with one more thing for some time and I would appreciate any help. My website consists of many pages and the link to page number X is mydomain.com/?page=X (e.g mydomain/?page=3), but I want to rewrite that URLs to mydomain.com/page/X Here is my .htaccess: RewriteEngine on

Url rewriting mod_rewrite

左心房为你撑大大i 提交于 2020-01-25 02:52:47
问题 I am working with mod_rewrite for the first time. I am going to present a scenario. Just let me know whether it's possible or not. suppose I have a database table with three attributes table(id,title,parentid). and my url to access the particular content looks like this: example.com/content.php?id=some_value Now, for some_value id , title is some_title. Is it possible that such that example.com/some_title/ can be renamed to above url.OR example.com/content.php?id=some_value&title=some_title I

url rewriting : How to rewrite 2 urls with same number of parameters?

一曲冷凌霜 提交于 2020-01-25 02:46:05
问题 I've created some url rewriting rules. It works fine. But i have 2 pages with urls like that : actualites.php?id=xxx& alias=xxx --> Result : id-alias.php (ex : 1-article_name.php) equipe.php?id=xxx& alias=xxx --> Result : id-alias.php ((ex : 1-article_name.php) These 2 pages are different, not the same design, etc. I would like to rewrite these 2 different pages. My question is how to have two different rules for these 2 urls. Since they have 2 parameters, i have only one rule applied (the

relative path doesn't work after adding a rewrite rule for appending trailing slash

时间秒杀一切 提交于 2020-01-25 00:07:22
问题 I have an index page placed in /forum/section1/. I have a rule to automatically redirect to the index page when I browse exampledomain.com/forum/section1/ . Sometimes when I forgot the trailing slash, it keeps loading and never goes to the index page. I have added a rule to append a trailing slash to every request: RewriteEngine on #From http://enarion.net/web/htaccess/trailing-slash/ RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ # Don't apply to images

Friendly URLs with .htacces weird response form my web hosting… HELP

十年热恋 提交于 2020-01-24 20:56:07
问题 I just wanted that when this is inserted in the URL: http://website.com/pelicula/0221889/ http://website.com/pelicula/0221889/posters/ It really goes to this (in background): http://website.com/index.php?ctrl=pelicula&id=0160399 http://website.com/index.php?ctrl=pelicula&id=0160399&tab=posters So I put this in my .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/([^/]+)/([^/]+)/?([^/]*)/?$ index.php?ctrl=$1&id=$2&tab=$3 [QSA,L] <

PrestaShop $link -> getProductLink($product) gives incorrect URL

泪湿孤枕 提交于 2020-01-24 13:01:45
问题 I'm generating my product links in custom ajax powered module with $link -> getProductLink($product) it's generating a URL like http://example.com/prestashop/2-blouse.html which is throwing an error saying [Debug] This page has moved Please use the following URL instead: http://example.com/prestashop/blouses/2-blouse.html How do I avoid the same Thanks P.S: I'm using prestashop 1.6 回答1: Set _PS_MODE_DEV_ to false in config/defines.inc.php . 回答2: In Preferences > SEO & URLs set disable

Hide PHP file extension from the URL

爷,独闯天下 提交于 2020-01-24 11:12:10
问题 I am storing my website's content in a database. It is like a CMS. One will add page content from an admin panel, and content will stored in the database. In one page, I have added 10-12 links as <a href="page.php/abc" and my URLs looks like www.example.com/page.php/abc . I want to hide .php from page.php . How can I do this without using .htaccess? I have tried with str_replace (added in page content from the CMS), but it seems like it does not recognise it as PHP code and take it as a

proxy_pass overwrites the URL changed by rewrite directive

Deadly 提交于 2020-01-24 00:33:32
问题 From the nginx documentation as quoted below, I understand that proxy_pass directive will not the change the URI and will just pass the rewritten URI to the server. When the URI is changed inside a proxied location using the rewrite directive, and this same configuration will be used to process a request (break): location /name/ { rewrite /name/([^/]+) /users?name=$1 break; proxy_pass http://127.0.0.1/randomstring; } In this case, the URI specified in the directive is ignored and the full

nginx hide symfony locale from url

拥有回忆 提交于 2020-01-23 16:44:29
问题 i have an issue with url rewriting in nginx server. i want to hide symfony's locale from my url so www.example.com/fr/route should be www.example.com/route my nginx config file has the following : location / { # try to serve file directly, fallback to app.php try_files $uri /app.php$is_args$args; } # PROD location ~ ^/app\.php(/|$) { fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; internal; } please help me and thanks a lot in

nginx hide symfony locale from url

徘徊边缘 提交于 2020-01-23 16:42:40
问题 i have an issue with url rewriting in nginx server. i want to hide symfony's locale from my url so www.example.com/fr/route should be www.example.com/route my nginx config file has the following : location / { # try to serve file directly, fallback to app.php try_files $uri /app.php$is_args$args; } # PROD location ~ ^/app\.php(/|$) { fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; internal; } please help me and thanks a lot in