.htaccess: Rewrite rule for URL [duplicate] - .htaccess

This question already has answers here:
Reference: mod_rewrite, URL rewriting and "pretty links" explained
(5 answers)
Closed 4 years ago.
How to use the .htaccess to change the url
https://example/userdetail.php?pn=1&order=user_id&sort=ASC&search=null
to
https://example/userdetail/1/user_id/ASC/null/

If you hava MVC then you can used like that:
Url:
<a href="/controllerName/1/user_id/ASC/null">
Make Route, an then
Controller:
class controllerName extends Controller {
public function index($ph, $order, $sort, $search){
}
}

Related

Using Flask to embed a local HTML page [duplicate]

This question already has answers here:
How to serve static files in Flask
(24 answers)
Closed 6 years ago.
So I am using this cool plugin called Folium which creates maps. The map gets created as a .html and every time you update the map it regenerates the html. So in order to display the map and my navbar and other stuff on the same page I think I would need to put map.html inside an iframe cage where it can refresh itself at will.
The map gets created thus:
map1 = folium.Map(location=[45.5, -73.61], width="100%", height="100%")
map1.save('./maps/map.html')
And I have tried iframeing it thus:
<iframe src="/maps/map.html"></iframe>
But I get 404 error
Someone yesterday suggested that I build an endpoint for it like this:
#app.route('/http://127.0.0.1:4995/maps/map')
def show_map():
return flask.send_file('/maps/map.html')
But I keep getting 404 error
You have your route defined incorrectly. As you had it written, you defined the route for http://yourserver/http://127.0.0.1:4995/maps/map when instead what I think you wanted was http://yourserver/maps/map.html. To achieve this, you will want to use the following
#app.route('/maps/map.html')
def show_map():
return flask.send_file('/maps/map.html')
Flask will automatically prepend your server's address (http://127.0.0.1:4995) to the beginning of any route that you define.
Also, in the template for your HTML, I would use url_for to get the URL for the map to avoid changes in your routes requiring changes to your templates.
<iframe src="{{ url_for('show_map') }}"></iframe>

I have to add .xhtml to image in css [duplicate]

This question already has answers here:
How to reference JSF image resource as CSS background image url
(2 answers)
Closed 6 years ago.
I have to add .xhtml in an url in css in order to have my image considered, else it's not found(no typo).
ex, this is found:
background-image: url(flags/flags-32.png.xhtml);
this is not found:
background-image: url(flags/flags-32.png);
my file is under resources/css/flags.
I've also a side question that is indirectly tied to this :
I've read somewhere that one shouldn't have extensions like .png.xhtml or .script.xhtml as it could impact negatively performances. I can't find the source of where I read that but I'd like to know why that is the case (maybe it's because of cache).
Try to add resource before your flag folder
url("#{resource['flags/flags-32.png']}");
when .xhtml is appended to the end of a file the url is :
javax.faces.resource/...
while if you want to access a .js file directly for example the url is :
resources/script/myscript.js
don't forget the s in resources.
You should try like this
background-image: url(../images/imageName.gif);
if your folder structure like this resources->images->imageName.gif.

Internationalization message with HTML tags [duplicate]

This question already has answers here:
Including HTML in JSF resource bundle string - possible? [duplicate]
(1 answer)
JSF please don't escape my html [duplicate]
(3 answers)
Closed 6 years ago.
I have the following message in my resource bundle properties file:
message1=This is a <strong>message</strong>
And in my facelets page I have:
<p>#{bundle.message1}</p>
However when the message is displayed it shows the tags as text so I see
"<strong>message</strong>"
instead of "message" in bold.
What do I have to do to see it in bold?

htaccess Rewriteurl Looping [duplicate]

This question already has answers here:
Absolute urls, relative urls, and...?
(5 answers)
Closed 7 years ago.
I have problem when using htaccess rewriteurl, it was stacking every I change the page,
I try this one :
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^category/([^/]*)/([^/]*)$ /test/category.php?k=$1&page=$2 [L]
change this
http://localhost/test/category.php?k=fashion&page=2
become like this
http://localhost/test/category/fashion/2
the problem occure when i'm going to page 3
URL become like this
http://localhost/test/category/fashion/category/fashion/3
so on...
switch page to page 4
http://localhost/test/category/fashion/category/fashion/category/fashion/3
why is this looping?
what's wrong with my code??
Because you've changed your URL's to look like http://localhost/test/category/fashion/2, any relative links on that page will think the new URL base is: http://localhost/test/category/fashion/ instead of http://localhost/test/, which would be the base if the browser loaded http://localhost/test/category.php?k=fashion&page=2. Because of this, you either need to make all your links absolute URLs or add the base in you html header:
<base href="/test/" />

Use of different fonts such as malayalam,hindi etc in a website [duplicate]

This question already has answers here:
Fonts on the Web [duplicate]
(10 answers)
Closed 8 years ago.
I am new to PHP. I am developing a news website in different languages.I am using ML-TTKarthika font for malayalam. My problem is that this font is not supported in all browers (Chrome,Opera). How I solve this problem. In my site Hindi,Tamil fonts are also needed. Please anyone give me an answer..Thanks in advance.
This should help you: http://www.w3schools.com/css/css3_fonts.asp
Especially the Part "Using The Font You want"
Basically you can provide a Font with CSS:
#font-face
{
font-family:myFirstFont;
src:url(/path/to/font.woff);
}
And then use it:
body
{
font-family:myFirstFont;
}

Resources