url-rewriting

PHP $_GET and .htaccess rewrite

半腔热情 提交于 2019-12-02 09:54:36
问题 I know this is probably a common question and has been asked before but .htacess looks foreign to me and I can't seem to get this to work from looking at previous questions. I have a index script that searches and the syntax is: .../listing/?field=property_type&query=retail I simply want to rewrite this to: .../listing/{field}/{query} One other catch, I have some fields that are boolean.. for example: .../listings/?forlease=1 So in this case I just use isset() but would like to rewrite this

How to remove GET parameters from url with htaccess?

邮差的信 提交于 2019-12-02 09:37:20
My website do not use any GET parameters except on one page. Nonetheless, I can see that Google managed to index a bunch of my pages with GET parameters. This is not great for SEO (duplicate content)... So I'm trying to edit my .htaccess to do 301 redirects between all urls with GET parameters to url without GET parameters (except for one url). Some examples: example.com/?foo=42 => example.com/ example.com/about?bar=42 => example.com/about example.com/r.php?foobar=42 => the url r.php should keep the GET parameters So far I'm trying to remove all GET parameters, and it doesn't work.

How to get query string and rewrite it in htaccess

时光毁灭记忆、已成空白 提交于 2019-12-02 09:30:04
问题 I have queries like this: example.com/folder/?q=keyword Please suggest how to redirect all queries that contain "keyword" as a parameter to other file on server: /folder/core/index.php?id=$1 I mean $1 must be keyword Here is my example: RewriteEngine On RewriteCond %{QUERY_STRING} ^q=\/(.*)$ RewriteRule ^/?$ /folder/core/index.php?id=$1 [L] 回答1: If you are using .htaccess in folder/ directory then try with below, RewriteEngine On RewriteCond %{QUERY_STRING} ^q=(.+)$ RewriteRule ^ /folder/core

URL rewriting - Beginners guide

余生长醉 提交于 2019-12-02 09:07:44
问题 I need to learn how to do URL rewriting for a site to get pretty URLs... I have a general idea of how it works through the 50 tutorials I read. But none of them really clicked and never managed to make it properly work. Do you know of any tutorials that are good for me to start? Here is an example of how I want to use it: Here is the basic link http://www.dico2rue.com/dictionnaire.php?idW=675&word=Resto-basket I want it to become like this: http://www.dico2rue.com/dictionnaire/675/Resto

how to simplify the url

别来无恙 提交于 2019-12-02 09:05:13
Hi: In my website I found that their url are very simple like: http://example.com/questions/4486620/randomaccessfile-probelm And generally the url should like: http://example.com/questions?xx=4486620&title=randomaccessfile-probelm That's to say there is no request parameters combined by "&" in the url. How did they make it? Is there any framework? UPDATE: My application works under tomcat. On an apache web server you can do this using mod_rewrite http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html Here is an example along with a tutorial... The Apache rewrite engine is mainly used to turn

How can I prevent exposing of content hiererchy paths within AEM? I am looking for alternatives both at AEM level as well as Dispatcher level

烈酒焚心 提交于 2019-12-02 09:03:00
As an example, how would you achieve: a. Translate a hit to www.mysite.com to www.mysite.com/en and b. Translate the above www.mysite.com/en to /content/mysite/en.html Shawn Take a look at resource mapping: https://docs.adobe.com/docs/en/aem/6-2/deploy/configuring/resource-mapping.html https://docs.adobe.com/docs/en/dispatcher/disp-domains.html#URL%20Mapping With mapping you can make it so the incoming URL (what the user sees in their browser) is one thing, but the URL that AEM sees when processing the incoming request is something else. Also see: URL Mapping based on Resource resolver in AEM

How to convert querystring to paths URL using mod_rewrite?

半城伤御伤魂 提交于 2019-12-02 08:50:45
问题 I'm trying to rewrite a URL that has a query string to its SEO friendly name i.e. consider mysite.com/models?p1=v1 I'd like to rewrite it to mysite.com/models/p1/v1 The user should see the above address in address bar. Any suggesstions? 回答1: The .htaccess should be: RewriteEngine On RewriteRule ^models/(.+)/(.+)$ models.php?$1=$2 [NC,L] 来源: https://stackoverflow.com/questions/13474950/how-to-convert-querystring-to-paths-url-using-mod-rewrite

URL rewrite issue not loading .css

孤人 提交于 2019-12-02 08:39:50
问题 I'm porting an old site to a new template and am having problems with the Windows 2008 rewrite module. The link I'm trying to rewrite looks like this: http://ltweb2008.serveronline.net/product.php?pID=75 and brings up the page just fine. Then I apply the new URL and it loads the proper content, but doesn't load the template's style.css file anymore. http://ltweb2008.serveronline.net/product/75/any-text-here The problem seems to be that the company who made the template (canvas) put the main

Shorten the URL from example.com/page.php?var=letters to example.com/letters

不打扰是莪最后的温柔 提交于 2019-12-02 08:29:46
I'm kinda new to URL Rewriting in .htaccess , and I tried to do it myself following some tutorials. No success though .... I want to shorten http://www.example.com/page.php?var=letters to http://www.example.com/letters ( letters is only an example). Any help is very welcomed. Can't get this done myself. :( <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f # if the requested file does not exist RewriteRule ^(.+)$ page.php?var=$1 # rewrite the request </IfModule> A more generic approach, to have all the links you want as domain.tld/person/jon/ RewriteEngine On

.htaccess image to web page redirect?

删除回忆录丶 提交于 2019-12-02 08:19:27
Is there a .htaccess script I can use to redirect the url of an image to an actual web page? What can I do to make it so when someone accesses an image via their address bar by typing in: http://www.sitename.com/uploads/192-file-name-here.jpg or other extensions like http://www.sitename.com/uploads/235-file-name-here.png It will instead redirect the user to the web page: http://www.sitename.com/view/192-file-name-here/ I want to still be able to place the images in image tags across the site and on external sites though. RewriteCond %{HTTP_REFERER} !^https?:\\www\.sitename\.com RewriteCond %