url-rewriting

Rewrite GET Query String using .htaccess

时光总嘲笑我的痴心妄想 提交于 2019-12-02 02:16:58
I want to Rewrite my GET Query String from this - http://www.example.com/verify.php?key=547b52f2b5d20d258e62de1e27b55c to this http://www.example.com/verify/547b52f2b5d20d258e62de1e27b55c I am using the following rule but it does not seem to work - RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(([A-Za-z0-9\-]+/)*[A-Za-z0-9\-]+)?$ $1.php RewriteRule ^[A-Za-z-]+/([A-Za-z0-9-]+)/?$ verify.php?key=$1 [NC,L] Use the following: RewriteEngine On RewriteCond %{THE_REQUEST} ^GET\ /verify\.php\?key=([^\s&]+) [NC] RewriteRule ^verify\.php$ /verify/

SEO friendly URL's with .htaccess

匆匆过客 提交于 2019-12-02 01:25:50
Can anybody please help me with some URL rewriting? I have (for example) these pages: www.mydomain.com/test/gallery.asp?id=2 www.mydomain.com/test/gallery.asp?id=3 and want them to be requested as: www.mydomain.com/photos/people www.mydomain.com/photos/wildlife I'm using IIS and at first my hosting provider was using ISAPI_Rewrite with a httpd.ini file, now they have switched to Helicon Ape with a .htaccess file. See: http://www.isapirewrite.com/ and http://www.helicontech.com/ape/ I tried it the ISAPI_Rewrite way: RewriteRule /photos/people /test/gallery.asp?id=2 [I,L] RewriteRule /photos

Spring 3.2 mvc, how to rewrite url within controller as part of redirectview with permanent status code sent

大憨熊 提交于 2019-12-02 01:24:21
@RequestMapping(value = "/Foo/{id}/{friendlyUrl:.*}", method = RequestMethod.GET) public ModelAndView getFoo(@PathVariable final Long id, @PathVariable final String friendlyUrl) { So it matches ID, and any string. But I want the user to see a string I specify. foo = fooService.get(id); //use id from pathvariable redirectView = new RedirectView(foo.getCorrectUrl()); //set url to correct url, not that in path redirectView.setStatusCode(HttpStatus.MOVED_PERMANENTLY); //moved permanently modelAndView = new ModelAndView(redirectView); modelAndView.setViewName("myFoo.jsp"); return modelAndView;

htaccess clean URL's what's the best way to do it?

风流意气都作罢 提交于 2019-12-02 01:18:56
I'm working on clean Url's for my website and I noticed that what you find on the internet is pretty much about rewriting your clean urls to the url that your server can work with. So something like this: www.domain.com/profile/username --> www.domain.com/profile.php?u=username RewriteEngine On RewriteRule ^profile/(.*)$ /profile.php?u=$1 [L] So now with this I should link within my website to the cleanurl's. But intuitively it feels more solid/better to link to the 'dirty' url. So in that case you should use rewriterules for the above AND a redirect rule to rederict the 'dirty url' to the

Apache .htaccess to hide both .php and .html extentions

三世轮回 提交于 2019-12-02 01:17:17
What lines should I add to remove both .html and .php extensions from my site? I use this for just the .html part: RewriteEngine on RewriteBase / RewriteCond %{http://jobler.ro/} !(\.[^./]+)$ RewriteCond %{REQUEST_fileNAME} !-d RewriteCond %{REQUEST_fileNAME} !-f RewriteRule (.*) /$1.html [L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP RewriteRule ^([^.]+)\.html$ http://jobler.ro/$1 [R=301,L] but I need for both file type extensions to be hidden from the same domain. I know its late to answer but I giving it since it can be useful to someone :) #Remove php extension

Redirect URLs with FQDN (dot after TLD) to equivalent with PQDN

断了今生、忘了曾经 提交于 2019-12-02 01:09:40
问题 Many websites can be accessed with a FQDN (i.e., appending a dot to the TLD): https://www.ebay.com./ https://www.google.com./ https://www.reddit.com./ https://stackoverflow.com./ https://en.wikipedia.org./wiki/Main_Page Some sites can’t be accessed that way, but I can’t find an example right now.¹ ² Is it possible, within a .htaccess file, to redirect all variants with the dot suffix to the variants without? Ideally with a "wildcard" rule, so that you don’t have to list the domains explicitly

.php url to .html url

最后都变了- 提交于 2019-12-02 01:05:10
问题 I have a website built in .php but we have converted it to .html by using "mod rewrite" . the mod rewrite code used in .htaccess is RewriteEngine on RewriteRule ^(.*)\.html$ $1.php Now the problem is my website shows up in both .php and .html . for example: www.mydomain.com/index.html and also www.mydomain.com/index.php . as per my knowledge its not good for seo purpose and also it may fall in duplicate content to search engines. so i want to keep only .html [not .php] url live on search

rewriting urls for static js and css files using nginx server

两盒软妹~` 提交于 2019-12-02 01:02:30
i would like to rewrite js and css files using nginx i have this urls pattern css : http://myhost.com/css/min/css_home.1330004285.css js : http://myhost.com/js/min/js_home.1330004285.js for the css files have to redirect to http://myhost.com/css/min/css_home.css and the same way for the js files i tried to resolve this by using thi solution but i doesn't work , it showing me an error when restarting nginx server location ~* \.(css|js) { rewrite /(.*)\.[\d]{10}\.(css|js) $1.$2 last; } The rewrite rule seems a bit over complicated. You can try this: rewrite /(.+/)\.+\.(css|js)$ /$1.$2 last; If

URL Mapping works on localhost but not on production server in asp.net

こ雲淡風輕ζ 提交于 2019-12-02 00:19:59
问题 I have certain values that are mapped in web.config file for URL Mapping . When i browse for file it works on localhost . But, when i deploy this application on IIS on Production it wont work. shows Error: " 404: The resource cannot be found. " dont know why? Any idea? Web.config markup: <urlMappings enabled="true"> <add url="~/Pune" mappedUrl="~/City.aspx?ID=1"/> </urlMappings> In .aspx file: <a href="Pune">Pune City</a> After searching i have got some clue that it must be: <urlMappings

500 Internal Server Error is coming when i'm redirecting my normal page to AMP page htaccess error

为君一笑 提交于 2019-12-02 00:14:41
This is my normal page code for Redirect AMP page. <meta name="original-source" content="https://www.themobilesapp.com/<?= $abc; ?>"> <link rel="canonical" href="https://www.themobilesapp.com/<?= $abc; ?>"> <link rel="amphtml" href="https://www.themobilesapp.com/ampspecification/<?= $abc; ?>"> Normal page url is https://www.themobilesapp.com/Nokia-Lumia-638-specifications-3029 This is working fine and AMP page url is not working https://www.themobilesapp.com/ampspecification/Nokia-Lumia-638-specifications-3029 but this amp works fine when I add ampspecification.php and other passing. But when